Merge pull request #1740 from valentinewallace/fix-historical-ntfns-reorg-test

chainntnfs/interface_test: fix unreliable historical block ntfns test
This commit is contained in:
Olaoluwa Osuntokun 2018-09-05 21:01:42 -07:00 committed by GitHub
commit fb95858afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1367,6 +1367,30 @@ func testCatchUpOnMissedBlocksWithReorg(miner1 *rpctest.Harness,
t.Fatalf("unable to join node on blocks: %v", err)
}
// The two should be on the same block hash.
timeout := time.After(10 * time.Second)
for {
nodeHash1, _, err := miner1.Node.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current block hash: %v", err)
}
nodeHash2, _, err := miner2.Node.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current block hash: %v", err)
}
if *nodeHash1 == *nodeHash2 {
break
}
select {
case <-timeout:
t.Fatalf("Unable to sync two chains")
case <-time.After(50 * time.Millisecond):
continue
}
}
// Next, start the notifier with outdated best block information.
// We set the notifier's best block to be the last block mined on the
// shorter chain, to test that the notifier correctly rewinds to