9
9
CInv ,
10
10
msg_getdata ,
11
11
)
12
- from test_framework .mininode import (
13
- mininode_lock ,
14
- P2PInterface ,
15
- )
12
+ from test_framework .mininode import P2PInterface
16
13
from test_framework .test_framework import BitcoinTestFramework
17
- from test_framework .util import wait_until
18
14
19
15
20
16
class P2PStoreBlock (P2PInterface ):
@@ -32,21 +28,21 @@ def set_test_params(self):
32
28
self .num_nodes = 1
33
29
34
30
def run_test (self ):
35
- self .nodes [0 ].add_p2p_connection (P2PStoreBlock ())
31
+ p2p_block_store = self .nodes [0 ].add_p2p_connection (P2PStoreBlock ())
36
32
37
33
self .log .info ("test that an invalid GETDATA doesn't prevent processing of future messages" )
38
34
39
35
# Send invalid message and verify that node responds to later ping
40
36
invalid_getdata = msg_getdata ()
41
37
invalid_getdata .inv .append (CInv (t = 0 , h = 0 )) # INV type 0 is invalid.
42
- self . nodes [ 0 ]. p2ps [ 0 ] .send_and_ping (invalid_getdata )
38
+ p2p_block_store .send_and_ping (invalid_getdata )
43
39
44
40
# Check getdata still works by fetching tip block
45
41
best_block = int (self .nodes [0 ].getbestblockhash (), 16 )
46
42
good_getdata = msg_getdata ()
47
43
good_getdata .inv .append (CInv (t = 2 , h = best_block ))
48
- self . nodes [ 0 ]. p2ps [ 0 ] .send_and_ping (good_getdata )
49
- wait_until (lambda : self .nodes [0 ].p2ps [0 ].blocks [best_block ] == 1 , timeout = 30 , lock = mininode_lock )
44
+ p2p_block_store .send_and_ping (good_getdata )
45
+ p2p_block_store . wait_until (lambda : self .nodes [0 ].p2ps [0 ].blocks [best_block ] == 1 )
50
46
51
47
52
48
if __name__ == '__main__' :
0 commit comments