You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

405 lines
10 KiB

blockchain: Reorg reactor (#3561) * go routines in blockchain reactor * Added reference to the go routine diagram * Initial commit * cleanup * Undo testing_logger change, committed by mistake * Fix the test loggers * pulled some fsm code into pool.go * added pool tests * changes to the design added block requests under peer moved the request trigger in the reactor poolRoutine, triggered now by a ticker in general moved everything required for making block requests smarter in the poolRoutine added a simple map of heights to keep track of what will need to be requested next added a few more tests * send errors to FSM in a different channel than blocks send errors (RemovePeer) from switch on a different channel than the one receiving blocks renamed channels added more pool tests * more pool tests * lint errors * more tests * more tests * switch fast sync to new implementation * fixed data race in tests * cleanup * finished fsm tests * address golangci comments :) * address golangci comments :) * Added timeout on next block needed to advance * updating docs and cleanup * fix issue in test from previous cleanup * cleanup * Added termination scenarios, tests and more cleanup * small fixes to adr, comments and cleanup * Fix bug in sendRequest() If we tried to send a request to a peer not present in the switch, a missing continue statement caused the request to be blackholed in a peer that was removed and never retried. While this bug was manifesting, the reactor kept asking for other blocks that would be stored and never consumed. Added the number of unconsumed blocks in the math for requesting blocks ahead of current processing height so eventually there will be no more blocks requested until the already received ones are consumed. * remove bpPeer's didTimeout field * Use distinct err codes for peer timeout and FSM timeouts * Don't allow peers to update with lower height * review comments from Ethan and Zarko * some cleanup, renaming, comments * Move block execution in separate goroutine * Remove pool's numPending * review comments * fix lint, remove old blockchain reactor and duplicates in fsm tests * small reorg around peer after review comments * add the reactor spec * verify block only once * review comments * change to int for max number of pending requests * cleanup and godoc * Add configuration flag fast sync version * golangci fixes * fix config template * move both reactor versions under blockchain * cleanup, golint, renaming stuff * updated documentation, fixed more golint warnings * integrate with behavior package * sync with master * gofmt * add changelog_pending entry * move to improvments * suggestion to changelog entry
5 years ago
blockchain: Reorg reactor (#3561) * go routines in blockchain reactor * Added reference to the go routine diagram * Initial commit * cleanup * Undo testing_logger change, committed by mistake * Fix the test loggers * pulled some fsm code into pool.go * added pool tests * changes to the design added block requests under peer moved the request trigger in the reactor poolRoutine, triggered now by a ticker in general moved everything required for making block requests smarter in the poolRoutine added a simple map of heights to keep track of what will need to be requested next added a few more tests * send errors to FSM in a different channel than blocks send errors (RemovePeer) from switch on a different channel than the one receiving blocks renamed channels added more pool tests * more pool tests * lint errors * more tests * more tests * switch fast sync to new implementation * fixed data race in tests * cleanup * finished fsm tests * address golangci comments :) * address golangci comments :) * Added timeout on next block needed to advance * updating docs and cleanup * fix issue in test from previous cleanup * cleanup * Added termination scenarios, tests and more cleanup * small fixes to adr, comments and cleanup * Fix bug in sendRequest() If we tried to send a request to a peer not present in the switch, a missing continue statement caused the request to be blackholed in a peer that was removed and never retried. While this bug was manifesting, the reactor kept asking for other blocks that would be stored and never consumed. Added the number of unconsumed blocks in the math for requesting blocks ahead of current processing height so eventually there will be no more blocks requested until the already received ones are consumed. * remove bpPeer's didTimeout field * Use distinct err codes for peer timeout and FSM timeouts * Don't allow peers to update with lower height * review comments from Ethan and Zarko * some cleanup, renaming, comments * Move block execution in separate goroutine * Remove pool's numPending * review comments * fix lint, remove old blockchain reactor and duplicates in fsm tests * small reorg around peer after review comments * add the reactor spec * verify block only once * review comments * change to int for max number of pending requests * cleanup and godoc * Add configuration flag fast sync version * golangci fixes * fix config template * move both reactor versions under blockchain * cleanup, golint, renaming stuff * updated documentation, fixed more golint warnings * integrate with behavior package * sync with master * gofmt * add changelog_pending entry * move to improvments * suggestion to changelog entry
5 years ago
cs/replay: execCommitBlock should not read from state.lastValidators (#3067) * execCommitBlock should not read from state.lastValidators * fix height 1 * fix blockchain/reactor_test * fix consensus/mempool_test * fix consensus/reactor_test * fix consensus/replay_test * add CHANGELOG * fix consensus/reactor_test * fix consensus/replay_test * add a test for replay validators change * fix mem_pool test * fix byzantine test * remove a redundant code * reduce validator change blocks to 6 * fix * return peer0 config * seperate testName * seperate testName 1 * seperate testName 2 * seperate app db path * seperate app db path 1 * add a lock before startNet * move the lock to reactor_test * simulate just once * try to find problem * handshake only saveState when app version changed * update gometalinter to 3.0.0 (#3233) in the attempt to fix https://circleci.com/gh/tendermint/tendermint/43165 also code is simplified by running gofmt -s . remove unused vars enable linters we're currently passing remove deprecated linters (cherry picked from commit d47094550315c094512a242445e0dde24b5a03f5) * gofmt code * goimport code * change the bool name to testValidatorsChange * adjust receive kvstore.ProtocolVersion * adjust receive kvstore.ProtocolVersion 1 * adjust receive kvstore.ProtocolVersion 3 * fix merge execution.go * fix merge develop * fix merge develop 1 * fix run cleanupFunc * adjust code according to reviewers' opinion * modify the func name match the convention * simplify simulate a chain containing some validator change txs 1 * test CI error * Merge remote-tracking branch 'upstream/develop' into fixReplay 1 * fix pubsub_test * subscribeUnbuffered vote channel
6 years ago
add support for block pruning via ABCI Commit response (#4588) * Added BlockStore.DeleteBlock() * Added initial block pruner prototype * wip * Added BlockStore.PruneBlocks() * Added consensus setting for block pruning * Added BlockStore base * Error on replay if base does not have blocks * Handle missing blocks when sending VoteSetMaj23Message * Error message tweak * Properly update blockstore state * Error message fix again * blockchain: ignore peer missing blocks * Added FIXME * Added test for block replay with truncated history * Handle peer base in blockchain reactor * Improved replay error handling * Added tests for Store.PruneBlocks() * Fix non-RPC handling of truncated block history * Panic on missing block meta in needProofBlock() * Updated changelog * Handle truncated block history in RPC layer * Added info about earliest block in /status RPC * Reorder height and base in blockchain reactor messages * Updated changelog * Fix tests * Appease linter * Minor review fixes * Non-empty BlockStores should always have base > 0 * Update code to assume base > 0 invariant * Added blockstore tests for pruning to 0 * Make sure we don't prune below the current base * Added BlockStore.Size() * config: added retain_blocks recommendations * Update v1 blockchain reactor to handle blockstore base * Added state database pruning * Propagate errors on missing validator sets * Comment tweaks * Improved error message Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * use ABCI field ResponseCommit.retain_height instead of retain-blocks config option * remove State.RetainHeight, return value instead * fix minor issues * rename pruneHeights() to pruneBlocks() * noop to fix GitHub borkage Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
5 years ago
test/blockchain/v0: mitigate test data race (#4886) Mitigates the below data race. The proper fix involves not fiddling with reactor internals, which needs a rewrite of the test and possible additional reactor infrastructure. ``` ================== WARNING: DATA RACE Write at 0x00c001118e78 by goroutine 187: github.com/tendermint/tendermint/blockchain/v0.TestBadBlockStopsPeer() /go/src/github.com/tendermint/tendermint/blockchain/v0/reactor_test.go:234 +0x9d7 testing.tRunner() /usr/local/go/src/testing/testing.go:992 +0x1eb Previous read at 0x00c001118e78 by goroutine 326: [failed to restore the stack] Goroutine 187 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:1043 +0x660 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1285 +0xa6 testing.tRunner() /usr/local/go/src/testing/testing.go:992 +0x1eb testing.runTests() /usr/local/go/src/testing/testing.go:1283 +0x527 testing.(*M).Run() /usr/local/go/src/testing/testing.go:1200 +0x2ff main.main() _testmain.go:112 +0x337 Goroutine 326 (running) created at: github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart() /go/src/github.com/tendermint/tendermint/blockchain/v0/reactor.go:118 +0x12c github.com/tendermint/tendermint/libs/service.(*BaseService).Start() /go/src/github.com/tendermint/tendermint/libs/service/service.go:140 +0x504 github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).Start() <autogenerated>:1 +0x43 github.com/tendermint/tendermint/p2p.(*Switch).OnStart() /go/src/github.com/tendermint/tendermint/p2p/switch.go:225 +0x120 github.com/tendermint/tendermint/libs/service.(*BaseService).Start() /go/src/github.com/tendermint/tendermint/libs/service/service.go:140 +0x504 github.com/tendermint/tendermint/p2p.StartSwitches() /go/src/github.com/tendermint/tendermint/p2p/test_util.go:168 +0x75 github.com/tendermint/tendermint/p2p.MakeConnectedSwitches() /go/src/github.com/tendermint/tendermint/p2p/test_util.go:89 +0x17d github.com/tendermint/tendermint/blockchain/v0.TestBadBlockStopsPeer() /go/src/github.com/tendermint/tendermint/blockchain/v0/reactor_test.go:209 +0x768 testing.tRunner() /usr/local/go/src/testing/testing.go:992 +0x1eb ================== panic: BlockStore can only save contiguous blocks. Wanted 149, got 147 goroutine 1259 [running]: github.com/tendermint/tendermint/store.(*BlockStore).SaveBlock(0xc000ff9cc0, 0xc001997180, 0xc0010c6a00, 0xc0013b3000) /go/src/github.com/tendermint/tendermint/store/store.go:276 +0xbc4 github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc001118d00, 0x107c000) /go/src/github.com/tendermint/tendermint/blockchain/v0/reactor.go:355 +0xe90 created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart /go/src/github.com/tendermint/tendermint/blockchain/v0/reactor.go:118 +0x12d FAIL github.com/tendermint/tendermint/blockchain/v0 11.447s FAIL ```
5 years ago
  1. package v0
  2. import (
  3. "fmt"
  4. "math/rand"
  5. "os"
  6. "testing"
  7. "time"
  8. "github.com/stretchr/testify/require"
  9. abci "github.com/tendermint/tendermint/abci/types"
  10. cfg "github.com/tendermint/tendermint/config"
  11. "github.com/tendermint/tendermint/libs/log"
  12. "github.com/tendermint/tendermint/mempool/mock"
  13. "github.com/tendermint/tendermint/p2p"
  14. bcproto "github.com/tendermint/tendermint/proto/tendermint/blockchain"
  15. "github.com/tendermint/tendermint/proxy"
  16. sm "github.com/tendermint/tendermint/state"
  17. "github.com/tendermint/tendermint/store"
  18. "github.com/tendermint/tendermint/types"
  19. dbm "github.com/tendermint/tm-db"
  20. )
  21. var rng = rand.New(rand.NewSource(time.Now().UnixNano()))
  22. type reactorTestSuite struct {
  23. reactor *Reactor
  24. app proxy.AppConns
  25. peerID p2p.NodeID
  26. blockchainChannel *p2p.Channel
  27. blockchainInCh chan p2p.Envelope
  28. blockchainOutCh chan p2p.Envelope
  29. blockchainPeerErrCh chan p2p.PeerError
  30. peerUpdatesCh chan p2p.PeerUpdate
  31. peerUpdates *p2p.PeerUpdatesCh
  32. }
  33. func setup(
  34. t *testing.T,
  35. genDoc *types.GenesisDoc,
  36. privVals []types.PrivValidator,
  37. maxBlockHeight int64,
  38. chBuf uint,
  39. ) *reactorTestSuite {
  40. t.Helper()
  41. require.Len(t, privVals, 1, "only one validator can be supported")
  42. app := &abci.BaseApplication{}
  43. cc := proxy.NewLocalClientCreator(app)
  44. proxyApp := proxy.NewAppConns(cc)
  45. require.NoError(t, proxyApp.Start())
  46. blockDB := dbm.NewMemDB()
  47. stateDB := dbm.NewMemDB()
  48. stateStore := sm.NewStore(stateDB)
  49. blockStore := store.NewBlockStore(blockDB)
  50. state, err := stateStore.LoadFromDBOrGenesisDoc(genDoc)
  51. require.NoError(t, err)
  52. fastSync := true
  53. db := dbm.NewMemDB()
  54. stateStore = sm.NewStore(db)
  55. blockExec := sm.NewBlockExecutor(
  56. stateStore,
  57. log.TestingLogger(),
  58. proxyApp.Consensus(),
  59. mock.Mempool{},
  60. sm.EmptyEvidencePool{},
  61. )
  62. require.NoError(t, stateStore.Save(state))
  63. for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {
  64. lastCommit := types.NewCommit(blockHeight-1, 0, types.BlockID{}, nil)
  65. if blockHeight > 1 {
  66. lastBlockMeta := blockStore.LoadBlockMeta(blockHeight - 1)
  67. lastBlock := blockStore.LoadBlock(blockHeight - 1)
  68. vote, err := types.MakeVote(
  69. lastBlock.Header.Height,
  70. lastBlockMeta.BlockID,
  71. state.Validators,
  72. privVals[0],
  73. lastBlock.Header.ChainID,
  74. time.Now(),
  75. )
  76. require.NoError(t, err)
  77. lastCommit = types.NewCommit(
  78. vote.Height,
  79. vote.Round,
  80. lastBlockMeta.BlockID,
  81. []types.CommitSig{vote.CommitSig()},
  82. )
  83. }
  84. thisBlock := makeBlock(blockHeight, state, lastCommit)
  85. thisParts := thisBlock.MakePartSet(types.BlockPartSizeBytes)
  86. blockID := types.BlockID{Hash: thisBlock.Hash(), PartSetHeader: thisParts.Header()}
  87. state, _, err = blockExec.ApplyBlock(state, blockID, thisBlock)
  88. require.NoError(t, err)
  89. blockStore.SaveBlock(thisBlock, thisParts, lastCommit)
  90. }
  91. pID := make([]byte, 16)
  92. _, err = rng.Read(pID)
  93. require.NoError(t, err)
  94. peerUpdatesCh := make(chan p2p.PeerUpdate, chBuf)
  95. rts := &reactorTestSuite{
  96. app: proxyApp,
  97. blockchainInCh: make(chan p2p.Envelope, chBuf),
  98. blockchainOutCh: make(chan p2p.Envelope, chBuf),
  99. blockchainPeerErrCh: make(chan p2p.PeerError, chBuf),
  100. peerUpdatesCh: peerUpdatesCh,
  101. peerUpdates: p2p.NewPeerUpdates(peerUpdatesCh),
  102. peerID: p2p.NodeID(fmt.Sprintf("%x", pID)),
  103. }
  104. rts.blockchainChannel = p2p.NewChannel(
  105. BlockchainChannel,
  106. new(bcproto.Message),
  107. rts.blockchainInCh,
  108. rts.blockchainOutCh,
  109. rts.blockchainPeerErrCh,
  110. )
  111. reactor, err := NewReactor(
  112. log.TestingLogger().With("module", "blockchain", "node", rts.peerID),
  113. state.Copy(),
  114. blockExec,
  115. blockStore,
  116. nil,
  117. rts.blockchainChannel,
  118. rts.peerUpdates,
  119. fastSync,
  120. )
  121. require.NoError(t, err)
  122. rts.reactor = reactor
  123. require.NoError(t, rts.reactor.Start())
  124. require.True(t, rts.reactor.IsRunning())
  125. t.Cleanup(func() {
  126. require.NoError(t, rts.reactor.Stop())
  127. require.NoError(t, rts.app.Stop())
  128. require.False(t, rts.reactor.IsRunning())
  129. })
  130. return rts
  131. }
  132. func simulateRouter(primary *reactorTestSuite, suites []*reactorTestSuite, dropChErr bool) {
  133. // create a mapping for efficient suite lookup by peer ID
  134. suitesByPeerID := make(map[p2p.NodeID]*reactorTestSuite)
  135. for _, suite := range suites {
  136. suitesByPeerID[suite.peerID] = suite
  137. }
  138. // Simulate a router by listening for all outbound envelopes and proxying the
  139. // envelope to the respective peer (suite).
  140. go func() {
  141. for envelope := range primary.blockchainOutCh {
  142. if envelope.Broadcast {
  143. for _, s := range suites {
  144. // broadcast to everyone except source
  145. if s.peerID != primary.peerID {
  146. s.blockchainInCh <- p2p.Envelope{
  147. From: primary.peerID,
  148. To: s.peerID,
  149. Message: envelope.Message,
  150. }
  151. }
  152. }
  153. } else {
  154. suitesByPeerID[envelope.To].blockchainInCh <- p2p.Envelope{
  155. From: primary.peerID,
  156. To: envelope.To,
  157. Message: envelope.Message,
  158. }
  159. }
  160. }
  161. }()
  162. go func() {
  163. for pErr := range primary.blockchainPeerErrCh {
  164. if dropChErr {
  165. primary.reactor.Logger.Debug("dropped peer error", "err", pErr.Err)
  166. } else {
  167. primary.peerUpdatesCh <- p2p.PeerUpdate{
  168. PeerID: pErr.PeerID,
  169. Status: p2p.PeerStatusRemoved,
  170. }
  171. }
  172. }
  173. }()
  174. }
  175. func TestReactor_AbruptDisconnect(t *testing.T) {
  176. config := cfg.ResetTestRoot("blockchain_reactor_test")
  177. defer os.RemoveAll(config.RootDir)
  178. genDoc, privVals := randGenesisDoc(config, 1, false, 30)
  179. maxBlockHeight := int64(64)
  180. testSuites := []*reactorTestSuite{
  181. setup(t, genDoc, privVals, maxBlockHeight, 0),
  182. setup(t, genDoc, privVals, 0, 0),
  183. }
  184. require.Equal(t, maxBlockHeight, testSuites[0].reactor.store.Height())
  185. for _, s := range testSuites {
  186. simulateRouter(s, testSuites, true)
  187. // connect reactor to every other reactor
  188. for _, ss := range testSuites {
  189. if s.peerID != ss.peerID {
  190. s.peerUpdatesCh <- p2p.PeerUpdate{
  191. Status: p2p.PeerStatusUp,
  192. PeerID: ss.peerID,
  193. }
  194. }
  195. }
  196. }
  197. secondaryPool := testSuites[1].reactor.pool
  198. require.Eventually(
  199. t,
  200. func() bool {
  201. height, _, _ := secondaryPool.GetStatus()
  202. return secondaryPool.MaxPeerHeight() > 0 && height > 0 && height < 10
  203. },
  204. 10*time.Second,
  205. 10*time.Millisecond,
  206. "expected node to be partially synced",
  207. )
  208. // Remove synced node from the syncing node which should not result in any
  209. // deadlocks or race conditions within the context of poolRoutine.
  210. testSuites[1].peerUpdatesCh <- p2p.PeerUpdate{
  211. Status: p2p.PeerStatusDown,
  212. PeerID: testSuites[0].peerID,
  213. }
  214. }
  215. func TestReactor_NoBlockResponse(t *testing.T) {
  216. config := cfg.ResetTestRoot("blockchain_reactor_test")
  217. defer os.RemoveAll(config.RootDir)
  218. genDoc, privVals := randGenesisDoc(config, 1, false, 30)
  219. maxBlockHeight := int64(65)
  220. testSuites := []*reactorTestSuite{
  221. setup(t, genDoc, privVals, maxBlockHeight, 0),
  222. setup(t, genDoc, privVals, 0, 0),
  223. }
  224. require.Equal(t, maxBlockHeight, testSuites[0].reactor.store.Height())
  225. for _, s := range testSuites {
  226. simulateRouter(s, testSuites, true)
  227. // connect reactor to every other reactor
  228. for _, ss := range testSuites {
  229. if s.peerID != ss.peerID {
  230. s.peerUpdatesCh <- p2p.PeerUpdate{
  231. Status: p2p.PeerStatusUp,
  232. PeerID: ss.peerID,
  233. }
  234. }
  235. }
  236. }
  237. testCases := []struct {
  238. height int64
  239. existent bool
  240. }{
  241. {maxBlockHeight + 2, false},
  242. {10, true},
  243. {1, true},
  244. {100, false},
  245. }
  246. secondaryPool := testSuites[1].reactor.pool
  247. require.Eventually(
  248. t,
  249. func() bool { return secondaryPool.MaxPeerHeight() > 0 && secondaryPool.IsCaughtUp() },
  250. 10*time.Second,
  251. 10*time.Millisecond,
  252. "expected node to be fully synced",
  253. )
  254. for _, tc := range testCases {
  255. block := testSuites[1].reactor.store.LoadBlock(tc.height)
  256. if tc.existent {
  257. require.True(t, block != nil)
  258. } else {
  259. require.Nil(t, block)
  260. }
  261. }
  262. }
  263. func TestReactor_BadBlockStopsPeer(t *testing.T) {
  264. config := cfg.ResetTestRoot("blockchain_reactor_test")
  265. defer os.RemoveAll(config.RootDir)
  266. maxBlockHeight := int64(48)
  267. genDoc, privVals := randGenesisDoc(config, 1, false, 30)
  268. testSuites := []*reactorTestSuite{
  269. setup(t, genDoc, privVals, maxBlockHeight, 1000), // fully synced node
  270. setup(t, genDoc, privVals, 0, 1000),
  271. setup(t, genDoc, privVals, 0, 1000),
  272. setup(t, genDoc, privVals, 0, 1000),
  273. setup(t, genDoc, privVals, 0, 1000), // new node
  274. }
  275. require.Equal(t, maxBlockHeight, testSuites[0].reactor.store.Height())
  276. for _, s := range testSuites[:len(testSuites)-1] {
  277. simulateRouter(s, testSuites, true)
  278. // connect reactor to every other reactor except the new node
  279. for _, ss := range testSuites[:len(testSuites)-1] {
  280. if s.peerID != ss.peerID {
  281. s.peerUpdatesCh <- p2p.PeerUpdate{
  282. Status: p2p.PeerStatusUp,
  283. PeerID: ss.peerID,
  284. }
  285. }
  286. }
  287. }
  288. require.Eventually(
  289. t,
  290. func() bool {
  291. caughtUp := true
  292. for _, s := range testSuites[1 : len(testSuites)-1] {
  293. if s.reactor.pool.MaxPeerHeight() == 0 || !s.reactor.pool.IsCaughtUp() {
  294. caughtUp = false
  295. }
  296. }
  297. return caughtUp
  298. },
  299. 10*time.Minute,
  300. 10*time.Millisecond,
  301. "expected all nodes to be fully synced",
  302. )
  303. for _, s := range testSuites[:len(testSuites)-1] {
  304. require.Len(t, s.reactor.pool.peers, 3)
  305. }
  306. // Mark testSuites[3] as an invalid peer which will cause newSuite to disconnect
  307. // from this peer.
  308. otherGenDoc, otherPrivVals := randGenesisDoc(config, 1, false, 30)
  309. otherSuite := setup(t, otherGenDoc, otherPrivVals, maxBlockHeight, 0)
  310. testSuites[3].reactor.store = otherSuite.reactor.store
  311. // add a fake peer just so we do not wait for the consensus ticker to timeout
  312. otherSuite.reactor.pool.SetPeerRange("00ff", 10, 10)
  313. // start the new peer's faux router
  314. newSuite := testSuites[len(testSuites)-1]
  315. simulateRouter(newSuite, testSuites, false)
  316. // connect all nodes to the new peer
  317. for _, s := range testSuites[:len(testSuites)-1] {
  318. newSuite.peerUpdatesCh <- p2p.PeerUpdate{
  319. Status: p2p.PeerStatusUp,
  320. PeerID: s.peerID,
  321. }
  322. }
  323. // wait for the new peer to catch up and become fully synced
  324. require.Eventually(
  325. t,
  326. func() bool { return newSuite.reactor.pool.MaxPeerHeight() > 0 && newSuite.reactor.pool.IsCaughtUp() },
  327. 10*time.Minute,
  328. 10*time.Millisecond,
  329. "expected new node to be fully synced",
  330. )
  331. require.Eventuallyf(
  332. t,
  333. func() bool { return len(newSuite.reactor.pool.peers) < len(testSuites)-1 },
  334. 10*time.Minute,
  335. 10*time.Millisecond,
  336. "invalid number of peers; expected < %d, got: %d",
  337. len(testSuites)-1,
  338. len(newSuite.reactor.pool.peers),
  339. )
  340. }