routing/chainview: give neutrino backend more time to catch up for re-org test

In this commit, we modify the test to explitlcy give the neutrino
backend more time to catch up compared to the RPC backends. We do this
as a recent change has been made in the neutrino backend to wait for the
filter headers to finish syncing before proceeding with the rescan
itself. As a result, we'll need to account for this in the test and
sleep enough to give the backend a chance to catch up.
This commit is contained in:
Olaoluwa Osuntokun 2018-07-31 18:46:13 -07:00
parent 293a377edd
commit 3c60861005
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -570,6 +570,13 @@ func testFilterBlockDisconnected(node *rpctest.Harness,
newBlocks := reorgView.FilteredBlocks() newBlocks := reorgView.FilteredBlocks()
disconnectedBlocks := reorgView.DisconnectedBlocks() disconnectedBlocks := reorgView.DisconnectedBlocks()
// If this the neutrino backend, then we'll give it some time to catch
// up, as it's a bit slower to consume new blocks compared to the RPC
// backends.
if _, ok := reorgView.(*CfFilteredChainView); ok {
time.Sleep(time.Second * 3)
}
_, oldHeight, err := reorgNode.Node.GetBestBlock() _, oldHeight, err := reorgNode.Node.GetBestBlock()
if err != nil { if err != nil {
t.Fatalf("unable to get current height: %v", err) t.Fatalf("unable to get current height: %v", err)
@ -599,7 +606,8 @@ func testFilterBlockDisconnected(node *rpctest.Harness,
case block := <-newBlocks: case block := <-newBlocks:
if i < oldHeight { if i < oldHeight {
t.Fatalf("did not expect to get new block "+ t.Fatalf("did not expect to get new block "+
"in iteration %d", i) "in iteration %d, old height: %v", i,
oldHeight)
} }
expectedHeight := uint32(i - oldHeight + 1) expectedHeight := uint32(i - oldHeight + 1)
if block.Height != expectedHeight { if block.Height != expectedHeight {