Skip to content

Commit

Permalink
Fix race condition in sendheaders.py (#2862)
Browse files Browse the repository at this point in the history
generate() will push INV messages to all nodes, including our test_node.
The original check_last_announcement() call done here will then
sporadically return Fals when the INV message is received shortly after
clear_last_announcement()

Solution is to check for the INV announcement first and then continue with
the test.
  • Loading branch information
codablock authored and UdjinM6 committed Apr 12, 2019
1 parent 0c54e41 commit 1d8c722
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qa/rpc-tests/sendheaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ def test_null_locators(self, test_node):
tip = self.nodes[0].getblockheader(self.nodes[0].generate(1)[0])
tip_hash = int(tip["hash"], 16)

# TODO this partly fixes the same thing that is fixed by https://github.com/bitcoin/bitcoin/pull/13192
# This will later conflict when backporting the actual fix. Just take everything from the Bitcoin fix as a
# resolution
assert_equal(test_node.check_last_announcement(headers=[], inv=[tip_hash]), True)

self.log.info("Verify getheaders with null locator and valid hashstop returns headers.")
test_node.clear_last_announcement()
test_node.get_headers(locator=[], hashstop=tip_hash)
Expand Down

0 comments on commit 1d8c722

Please sign in to comment.