This commit picks up #17335 to add an updated version of a test by Suhas Daftuar in issue #5806 to demonstrate a block propagation issue for the first coinbase following an invalidateblock
. As Suhas reported: "[only] the first 16 [blocks] will make it, because of the call to getdata on processing each inv, which occurs until we’ve maxed out the number of blocks in flight to that peer."
Here we test that after running invalidateblock
, on the first coinbase transaction nodes will resync to a new lower chain tip, but for the non-mining node only reliably up to the number of blocks equal to the value (16) of MAX_BLOCKS_IN_TRANSIT_PER_PEER
. We then check that it catches up to the chain tip with the next coinbase transactions.
Reviewers may test this by running the test with different values of BLOCKS
in the test and with rebuilding using different values of MAX_BLOCKS_IN_TRANSIT_PER_PEER
in net_processing.cpp.