diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2020-10-12 00:22:16 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2020-10-12 00:22:16 +0200 |
commit | 5b77f8098de537898151ab116d0e547fd6ff9466 (patch) | |
tree | 896407415d56e4e795a534a2fad6aa372a1faa8b | |
parent | cc8c6823b4a8b74922f78ce6ce527ced9325bd49 (diff) |
test: add p2p_lock acquires in p2p_leak_tx.py
-rwxr-xr-x | test/functional/p2p_leak_tx.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/functional/p2p_leak_tx.py b/test/functional/p2p_leak_tx.py index e52c8f6f99..a45f792e81 100755 --- a/test/functional/p2p_leak_tx.py +++ b/test/functional/p2p_leak_tx.py @@ -5,7 +5,7 @@ """Test that we don't leak txs to inbound peers that we haven't yet announced to""" from test_framework.messages import msg_getdata, CInv, MSG_TX -from test_framework.p2p import P2PDataStore +from test_framework.p2p import p2p_lock, P2PDataStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, @@ -39,14 +39,16 @@ class P2PLeakTxTest(BitcoinTestFramework): want_tx = msg_getdata() want_tx.inv.append(CInv(t=MSG_TX, h=int(txid, 16))) - inbound_peer.last_message.pop('notfound', None) + with p2p_lock: + inbound_peer.last_message.pop('notfound', None) inbound_peer.send_and_ping(want_tx) if inbound_peer.last_message.get('notfound'): self.log.debug('tx {} was not yet announced to us.'.format(txid)) self.log.debug("node has responded with a notfound message. End test.") assert_equal(inbound_peer.last_message['notfound'].vec[0].hash, int(txid, 16)) - inbound_peer.last_message.pop('notfound') + with p2p_lock: + inbound_peer.last_message.pop('notfound') break else: self.log.debug('tx {} was already announced to us. Try test again.'.format(txid)) |