Lately on the Diff Testing we have seen random failures in this test.
By looking at logs we can see the following race condition was happening:
- Node0 generates some new blocks.
- Node1 requests & receives headers.
- Node0 runs invalidateblock on some blocks.
- Node1 requests the blocks corresponding to the full header list.
- Node0 ignores requests of invalid blocks, per BlockRequestAllowed.
- Node0 re-validates those blocks and continues on.
- Test proceeds up to wait_for_tip(). However, Node1 is still waiting for blocks that will never come. Timeout after 60 seconds.
This should break the race by requiring node1 to be synced before any rewind commands are done.
(thanks to @florian for noticing this in the logs)