[tests] fix flakiness in sendheaders.py
commitf0c4ab9a7034aca6be83fcb6cd8479cd19a196a2
authorJohn Newbery <john@johnnewbery.com>
Thu, 16 Nov 2017 16:52:59 +0000 (16 11:52 -0500)
committerJohn Newbery <john@johnnewbery.com>
Thu, 16 Nov 2017 18:45:46 +0000 (16 13:45 -0500)
tree9094a4b07d53ccb34a14475ea43f5617af96fef4
parent25fd6e2c202c113a2413ba9df76fe0ea0e4cbe5c
[tests] fix flakiness in sendheaders.py

Fixes to sources of intermittent failure in sendheaders.py

- at the start of test_null_locators(), a new block is generated and
then a getheaders is sent. check_last_accouncement() is called to assert
that the headers message is received. However, the new block triggers an
inv to be sent over both P2P connections, so there's a race. If the inv
is received at the wrong time, the test fails.

- test_null_locators() ends by sending a block to the node under test.
At the start of test_nonnull_locators(), a block is mined and
check_last_announcement() is called to assert that the inv received is
for the same block. That means there's a race: if the inv from the block
sent in test_null_locators() is received at the wrong time, the test
fails.
test/functional/sendheaders.py