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.

397 lines
11 KiB

cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 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
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
  1. package blocksync
  2. import (
  3. "context"
  4. "os"
  5. "testing"
  6. "time"
  7. "github.com/stretchr/testify/require"
  8. dbm "github.com/tendermint/tm-db"
  9. abciclient "github.com/tendermint/tendermint/abci/client"
  10. abci "github.com/tendermint/tendermint/abci/types"
  11. "github.com/tendermint/tendermint/config"
  12. "github.com/tendermint/tendermint/internal/consensus"
  13. "github.com/tendermint/tendermint/internal/mempool/mock"
  14. "github.com/tendermint/tendermint/internal/p2p"
  15. "github.com/tendermint/tendermint/internal/p2p/p2ptest"
  16. "github.com/tendermint/tendermint/internal/proxy"
  17. sm "github.com/tendermint/tendermint/internal/state"
  18. sf "github.com/tendermint/tendermint/internal/state/test/factory"
  19. "github.com/tendermint/tendermint/internal/store"
  20. "github.com/tendermint/tendermint/internal/test/factory"
  21. "github.com/tendermint/tendermint/libs/log"
  22. bcproto "github.com/tendermint/tendermint/proto/tendermint/blocksync"
  23. "github.com/tendermint/tendermint/types"
  24. )
  25. type reactorTestSuite struct {
  26. network *p2ptest.Network
  27. logger log.Logger
  28. nodes []types.NodeID
  29. reactors map[types.NodeID]*Reactor
  30. app map[types.NodeID]proxy.AppConns
  31. blockSyncChannels map[types.NodeID]*p2p.Channel
  32. peerChans map[types.NodeID]chan p2p.PeerUpdate
  33. peerUpdates map[types.NodeID]*p2p.PeerUpdates
  34. blockSync bool
  35. }
  36. func setup(
  37. ctx context.Context,
  38. t *testing.T,
  39. genDoc *types.GenesisDoc,
  40. privVal types.PrivValidator,
  41. maxBlockHeights []int64,
  42. chBuf uint,
  43. ) *reactorTestSuite {
  44. t.Helper()
  45. var cancel context.CancelFunc
  46. ctx, cancel = context.WithCancel(ctx)
  47. numNodes := len(maxBlockHeights)
  48. require.True(t, numNodes >= 1,
  49. "must specify at least one block height (nodes)")
  50. rts := &reactorTestSuite{
  51. logger: log.TestingLogger().With("module", "block_sync", "testCase", t.Name()),
  52. network: p2ptest.MakeNetwork(ctx, t, p2ptest.NetworkOptions{NumNodes: numNodes}),
  53. nodes: make([]types.NodeID, 0, numNodes),
  54. reactors: make(map[types.NodeID]*Reactor, numNodes),
  55. app: make(map[types.NodeID]proxy.AppConns, numNodes),
  56. blockSyncChannels: make(map[types.NodeID]*p2p.Channel, numNodes),
  57. peerChans: make(map[types.NodeID]chan p2p.PeerUpdate, numNodes),
  58. peerUpdates: make(map[types.NodeID]*p2p.PeerUpdates, numNodes),
  59. blockSync: true,
  60. }
  61. chDesc := &p2p.ChannelDescriptor{ID: BlockSyncChannel, MessageType: new(bcproto.Message)}
  62. rts.blockSyncChannels = rts.network.MakeChannelsNoCleanup(ctx, t, chDesc)
  63. i := 0
  64. for nodeID := range rts.network.Nodes {
  65. rts.addNode(ctx, t, nodeID, genDoc, privVal, maxBlockHeights[i])
  66. i++
  67. }
  68. t.Cleanup(func() {
  69. cancel()
  70. for _, nodeID := range rts.nodes {
  71. if rts.reactors[nodeID].IsRunning() {
  72. rts.reactors[nodeID].Wait()
  73. rts.app[nodeID].Wait()
  74. require.False(t, rts.reactors[nodeID].IsRunning())
  75. }
  76. }
  77. })
  78. return rts
  79. }
  80. func (rts *reactorTestSuite) addNode(
  81. ctx context.Context,
  82. t *testing.T,
  83. nodeID types.NodeID,
  84. genDoc *types.GenesisDoc,
  85. privVal types.PrivValidator,
  86. maxBlockHeight int64,
  87. ) {
  88. t.Helper()
  89. logger := log.TestingLogger()
  90. rts.nodes = append(rts.nodes, nodeID)
  91. rts.app[nodeID] = proxy.NewAppConns(abciclient.NewLocalCreator(&abci.BaseApplication{}), logger, proxy.NopMetrics())
  92. require.NoError(t, rts.app[nodeID].Start(ctx))
  93. blockDB := dbm.NewMemDB()
  94. stateDB := dbm.NewMemDB()
  95. stateStore := sm.NewStore(stateDB)
  96. blockStore := store.NewBlockStore(blockDB)
  97. state, err := sm.MakeGenesisState(genDoc)
  98. require.NoError(t, err)
  99. require.NoError(t, stateStore.Save(state))
  100. blockExec := sm.NewBlockExecutor(
  101. stateStore,
  102. log.TestingLogger(),
  103. rts.app[nodeID].Consensus(),
  104. mock.Mempool{},
  105. sm.EmptyEvidencePool{},
  106. blockStore,
  107. )
  108. for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {
  109. lastCommit := types.NewCommit(blockHeight-1, 0, types.BlockID{}, nil)
  110. if blockHeight > 1 {
  111. lastBlockMeta := blockStore.LoadBlockMeta(blockHeight - 1)
  112. lastBlock := blockStore.LoadBlock(blockHeight - 1)
  113. vote, err := factory.MakeVote(
  114. ctx,
  115. privVal,
  116. lastBlock.Header.ChainID, 0,
  117. lastBlock.Header.Height, 0, 2,
  118. lastBlockMeta.BlockID,
  119. time.Now(),
  120. )
  121. require.NoError(t, err)
  122. lastCommit = types.NewCommit(
  123. vote.Height,
  124. vote.Round,
  125. lastBlockMeta.BlockID,
  126. []types.CommitSig{vote.CommitSig()},
  127. )
  128. }
  129. thisBlock, err := sf.MakeBlock(state, blockHeight, lastCommit)
  130. require.NoError(t, err)
  131. thisParts, err := thisBlock.MakePartSet(types.BlockPartSizeBytes)
  132. require.NoError(t, err)
  133. blockID := types.BlockID{Hash: thisBlock.Hash(), PartSetHeader: thisParts.Header()}
  134. state, err = blockExec.ApplyBlock(ctx, state, blockID, thisBlock)
  135. require.NoError(t, err)
  136. blockStore.SaveBlock(thisBlock, thisParts, lastCommit)
  137. }
  138. rts.peerChans[nodeID] = make(chan p2p.PeerUpdate)
  139. rts.peerUpdates[nodeID] = p2p.NewPeerUpdates(rts.peerChans[nodeID], 1)
  140. rts.network.Nodes[nodeID].PeerManager.Register(ctx, rts.peerUpdates[nodeID])
  141. chCreator := func(ctx context.Context, chdesc *p2p.ChannelDescriptor) (*p2p.Channel, error) {
  142. return rts.blockSyncChannels[nodeID], nil
  143. }
  144. rts.reactors[nodeID], err = NewReactor(
  145. ctx,
  146. rts.logger.With("nodeID", nodeID),
  147. state.Copy(),
  148. blockExec,
  149. blockStore,
  150. nil,
  151. chCreator,
  152. rts.peerUpdates[nodeID],
  153. rts.blockSync,
  154. consensus.NopMetrics(),
  155. nil, // eventbus, can be nil
  156. )
  157. require.NoError(t, err)
  158. require.NoError(t, rts.reactors[nodeID].Start(ctx))
  159. require.True(t, rts.reactors[nodeID].IsRunning())
  160. }
  161. func (rts *reactorTestSuite) start(ctx context.Context, t *testing.T) {
  162. t.Helper()
  163. rts.network.Start(ctx, t)
  164. require.Len(t,
  165. rts.network.RandomNode().PeerManager.Peers(),
  166. len(rts.nodes)-1,
  167. "network does not have expected number of nodes")
  168. }
  169. func TestReactor_AbruptDisconnect(t *testing.T) {
  170. ctx, cancel := context.WithCancel(context.Background())
  171. defer cancel()
  172. cfg, err := config.ResetTestRoot("block_sync_reactor_test")
  173. require.NoError(t, err)
  174. defer os.RemoveAll(cfg.RootDir)
  175. valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
  176. genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil)
  177. maxBlockHeight := int64(64)
  178. rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0}, 0)
  179. require.Equal(t, maxBlockHeight, rts.reactors[rts.nodes[0]].store.Height())
  180. rts.start(ctx, t)
  181. secondaryPool := rts.reactors[rts.nodes[1]].pool
  182. require.Eventually(
  183. t,
  184. func() bool {
  185. height, _, _ := secondaryPool.GetStatus()
  186. return secondaryPool.MaxPeerHeight() > 0 && height > 0 && height < 10
  187. },
  188. 10*time.Second,
  189. 10*time.Millisecond,
  190. "expected node to be partially synced",
  191. )
  192. // Remove synced node from the syncing node which should not result in any
  193. // deadlocks or race conditions within the context of poolRoutine.
  194. rts.peerChans[rts.nodes[1]] <- p2p.PeerUpdate{
  195. Status: p2p.PeerStatusDown,
  196. NodeID: rts.nodes[0],
  197. }
  198. rts.network.Nodes[rts.nodes[1]].PeerManager.Disconnected(ctx, rts.nodes[0])
  199. }
  200. func TestReactor_SyncTime(t *testing.T) {
  201. ctx, cancel := context.WithCancel(context.Background())
  202. defer cancel()
  203. cfg, err := config.ResetTestRoot("block_sync_reactor_test")
  204. require.NoError(t, err)
  205. defer os.RemoveAll(cfg.RootDir)
  206. valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
  207. genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil)
  208. maxBlockHeight := int64(101)
  209. rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0}, 0)
  210. require.Equal(t, maxBlockHeight, rts.reactors[rts.nodes[0]].store.Height())
  211. rts.start(ctx, t)
  212. require.Eventually(
  213. t,
  214. func() bool {
  215. return rts.reactors[rts.nodes[1]].GetRemainingSyncTime() > time.Nanosecond &&
  216. rts.reactors[rts.nodes[1]].pool.getLastSyncRate() > 0.001
  217. },
  218. 10*time.Second,
  219. 10*time.Millisecond,
  220. "expected node to be partially synced",
  221. )
  222. }
  223. func TestReactor_NoBlockResponse(t *testing.T) {
  224. ctx, cancel := context.WithCancel(context.Background())
  225. defer cancel()
  226. cfg, err := config.ResetTestRoot("block_sync_reactor_test")
  227. require.NoError(t, err)
  228. defer os.RemoveAll(cfg.RootDir)
  229. valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
  230. genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil)
  231. maxBlockHeight := int64(65)
  232. rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0}, 0)
  233. require.Equal(t, maxBlockHeight, rts.reactors[rts.nodes[0]].store.Height())
  234. rts.start(ctx, t)
  235. testCases := []struct {
  236. height int64
  237. existent bool
  238. }{
  239. {maxBlockHeight + 2, false},
  240. {10, true},
  241. {1, true},
  242. {100, false},
  243. }
  244. secondaryPool := rts.reactors[rts.nodes[1]].pool
  245. require.Eventually(
  246. t,
  247. func() bool { return secondaryPool.MaxPeerHeight() > 0 && secondaryPool.IsCaughtUp() },
  248. 10*time.Second,
  249. 10*time.Millisecond,
  250. "expected node to be fully synced",
  251. )
  252. for _, tc := range testCases {
  253. block := rts.reactors[rts.nodes[1]].store.LoadBlock(tc.height)
  254. if tc.existent {
  255. require.True(t, block != nil)
  256. } else {
  257. require.Nil(t, block)
  258. }
  259. }
  260. }
  261. func TestReactor_BadBlockStopsPeer(t *testing.T) {
  262. // Ultimately, this should be refactored to be less integration test oriented
  263. // and more unit test oriented by simply testing channel sends and receives.
  264. // See: https://github.com/tendermint/tendermint/issues/6005
  265. t.SkipNow()
  266. ctx, cancel := context.WithCancel(context.Background())
  267. defer cancel()
  268. cfg, err := config.ResetTestRoot("block_sync_reactor_test")
  269. require.NoError(t, err)
  270. defer os.RemoveAll(cfg.RootDir)
  271. maxBlockHeight := int64(48)
  272. valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
  273. genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil)
  274. rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0, 0, 0, 0}, 1000)
  275. require.Equal(t, maxBlockHeight, rts.reactors[rts.nodes[0]].store.Height())
  276. rts.start(ctx, t)
  277. require.Eventually(
  278. t,
  279. func() bool {
  280. caughtUp := true
  281. for _, id := range rts.nodes[1 : len(rts.nodes)-1] {
  282. if rts.reactors[id].pool.MaxPeerHeight() == 0 || !rts.reactors[id].pool.IsCaughtUp() {
  283. caughtUp = false
  284. }
  285. }
  286. return caughtUp
  287. },
  288. 10*time.Minute,
  289. 10*time.Millisecond,
  290. "expected all nodes to be fully synced",
  291. )
  292. for _, id := range rts.nodes[:len(rts.nodes)-1] {
  293. require.Len(t, rts.reactors[id].pool.peers, 3)
  294. }
  295. // Mark testSuites[3] as an invalid peer which will cause newSuite to disconnect
  296. // from this peer.
  297. //
  298. // XXX: This causes a potential race condition.
  299. // See: https://github.com/tendermint/tendermint/issues/6005
  300. valSet, otherPrivVals := factory.ValidatorSet(ctx, t, 1, 30)
  301. otherGenDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil)
  302. newNode := rts.network.MakeNode(ctx, t, p2ptest.NodeOptions{
  303. MaxPeers: uint16(len(rts.nodes) + 1),
  304. MaxConnected: uint16(len(rts.nodes) + 1),
  305. })
  306. rts.addNode(ctx, t, newNode.NodeID, otherGenDoc, otherPrivVals[0], maxBlockHeight)
  307. // add a fake peer just so we do not wait for the consensus ticker to timeout
  308. rts.reactors[newNode.NodeID].pool.SetPeerRange("00ff", 10, 10)
  309. // wait for the new peer to catch up and become fully synced
  310. require.Eventually(
  311. t,
  312. func() bool {
  313. return rts.reactors[newNode.NodeID].pool.MaxPeerHeight() > 0 && rts.reactors[newNode.NodeID].pool.IsCaughtUp()
  314. },
  315. 10*time.Minute,
  316. 10*time.Millisecond,
  317. "expected new node to be fully synced",
  318. )
  319. require.Eventuallyf(
  320. t,
  321. func() bool { return len(rts.reactors[newNode.NodeID].pool.peers) < len(rts.nodes)-1 },
  322. 10*time.Minute,
  323. 10*time.Millisecond,
  324. "invalid number of peers; expected < %d, got: %d",
  325. len(rts.nodes)-1,
  326. len(rts.reactors[newNode.NodeID].pool.peers),
  327. )
  328. }