Merge #18213: test: Fix race in p2p_segwit

fa2cf85e6f test: Fix race in p2p_segwit (MarcoFalke)

Pull request description:

  Fixes #11696

Top commit has no ACKs.

Tree-SHA512: 09de07ea26236547586f5c373a0df2b68d84af5cfa8f40bd2ca9f951fc083c5f4b8a472a60668d99118bbd9f3942ec3d6a34f05944d47345acca41c95475bb27
This commit is contained in:
MarcoFalke 2020-03-12 09:15:40 -04:00
commit 2737197ff3
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

View File

@ -147,6 +147,11 @@ class TestP2PConn(P2PInterface):
super().__init__() super().__init__()
self.getdataset = set() self.getdataset = set()
# Avoid sending out msg_getdata in the mininode thread as a reply to invs.
# They are not needed and would only lead to races because we send msg_getdata out in the test thread
def on_inv(self, message):
pass
def on_getdata(self, message): def on_getdata(self, message):
for inv in message.inv: for inv in message.inv:
self.getdataset.add(inv.hash) self.getdataset.add(inv.hash)