File tree 1 file changed +5
-3
lines changed 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 5
5
"""Test that we don't leak txs to inbound peers that we haven't yet announced to"""
6
6
7
7
from test_framework .messages import msg_getdata , CInv , MSG_TX
8
- from test_framework .p2p import P2PDataStore
8
+ from test_framework .p2p import p2p_lock , P2PDataStore
9
9
from test_framework .test_framework import BitcoinTestFramework
10
10
from test_framework .util import (
11
11
assert_equal ,
@@ -39,14 +39,16 @@ def run_test(self):
39
39
40
40
want_tx = msg_getdata ()
41
41
want_tx .inv .append (CInv (t = MSG_TX , h = int (txid , 16 )))
42
- inbound_peer .last_message .pop ('notfound' , None )
42
+ with p2p_lock :
43
+ inbound_peer .last_message .pop ('notfound' , None )
43
44
inbound_peer .send_and_ping (want_tx )
44
45
45
46
if inbound_peer .last_message .get ('notfound' ):
46
47
self .log .debug ('tx {} was not yet announced to us.' .format (txid ))
47
48
self .log .debug ("node has responded with a notfound message. End test." )
48
49
assert_equal (inbound_peer .last_message ['notfound' ].vec [0 ].hash , int (txid , 16 ))
49
- inbound_peer .last_message .pop ('notfound' )
50
+ with p2p_lock :
51
+ inbound_peer .last_message .pop ('notfound' )
50
52
break
51
53
else :
52
54
self .log .debug ('tx {} was already announced to us. Try test again.' .format (txid ))
You can’t perform that action at this time.
0 commit comments