The test has many issues:
- The
send_blocks_until_disconnectedseems to imply to wait until a disconnect happens. However, in reality it will blindly send all blocks and then return early, when done or when a disconnect happens. This will cause test failures when python is running faster than Bitcoin Core, for example when using sanitizers. - The
assert_debug_logscopes are bloated, which makes finding the above issue harder. This is, because a test failure will basically print the 1000+ line debug log excerpt twice, with the second instance stripped of useful python test logs. Also, the checks are less precise, if they happen over a larger scope/snippet.
Fix all issues, by:
- Removing
send_blocks_until_disconnectedand just sending the blocks that are needed to get the disconnect and then explicitly waiting for the disconnect. - Reduce the scopes of the debug log checks. This can be reviewed with the git options
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space.