diff --git a/blockchain/pool.go b/blockchain/pool.go index 528c6654..3de2c296 100644 --- a/blockchain/pool.go +++ b/blockchain/pool.go @@ -12,7 +12,6 @@ import ( const ( maxOutstandingRequestsPerPeer = 10 eventsChannelCapacity = 100 - requestTimeoutSeconds = 10 maxTries = 3 requestIntervalMS = 500 requestBatchSize = 50 @@ -21,6 +20,10 @@ const ( maxPeersPerRequest = 1 ) +var ( + requestTimeoutSeconds = time.Duration(10) +) + type BlockRequest struct { Height uint PeerId string diff --git a/blockchain/pool_test.go b/blockchain/pool_test.go index 4376f3ac..a2578aa1 100644 --- a/blockchain/pool_test.go +++ b/blockchain/pool_test.go @@ -3,6 +3,7 @@ package blockchain import ( "math/rand" "testing" + "time" . "github.com/tendermint/tendermint/common" "github.com/tendermint/tendermint/types" @@ -74,6 +75,10 @@ func TestBasic(t *testing.T) { } func TestTimeout(t *testing.T) { + origRequestTimeoutSeconds := requestTimeoutSeconds + requestTimeoutSeconds = time.Duration(0) + defer func() { requestTimeoutSeconds = origRequestTimeoutSeconds }() + peers := makePeers(100, 0, 1000) start := uint(42) timeoutsCh := make(chan string, 10)