Fix blockchain pool tests

This commit is contained in:
Jae Kwon
2015-09-09 21:44:48 -07:00
parent 625f23af13
commit 3a5741f70f
3 changed files with 37 additions and 14 deletions

View File

@@ -25,8 +25,8 @@ func makePeers(numPeers int, minHeight, maxHeight int) map[string]testPeer {
}
func TestBasic(t *testing.T) {
peers := makePeers(10, 0, 1000)
start := 42
peers := makePeers(10, start+1, 1000)
timeoutsCh := make(chan string, 100)
requestsCh := make(chan BlockRequest, 100)
pool := NewBlockPool(start, requestsCh, timeoutsCh)
@@ -77,13 +77,17 @@ func TestBasic(t *testing.T) {
}
func TestTimeout(t *testing.T) {
peers := makePeers(10, 0, 1000)
start := 42
peers := makePeers(10, start+1, 1000)
timeoutsCh := make(chan string, 100)
requestsCh := make(chan BlockRequest, 100)
pool := NewBlockPool(start, requestsCh, timeoutsCh)
pool.Start()
for _, peer := range peers {
log.Info("Peer", peer.id)
}
// Introduce each peer.
go func() {
for _, peer := range peers {