Skip to content

Commit fa80b47

Browse files
author
MarcoFalke
committed
test: Remove global wait_until from p2p_getdata
1 parent 999922b commit fa80b47

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

test/functional/p2p_getdata.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99
CInv,
1010
msg_getdata,
1111
)
12-
from test_framework.mininode import (
13-
mininode_lock,
14-
P2PInterface,
15-
)
12+
from test_framework.mininode import P2PInterface
1613
from test_framework.test_framework import BitcoinTestFramework
17-
from test_framework.util import wait_until
1814

1915

2016
class P2PStoreBlock(P2PInterface):
@@ -32,21 +28,21 @@ def set_test_params(self):
3228
self.num_nodes = 1
3329

3430
def run_test(self):
35-
self.nodes[0].add_p2p_connection(P2PStoreBlock())
31+
p2p_block_store = self.nodes[0].add_p2p_connection(P2PStoreBlock())
3632

3733
self.log.info("test that an invalid GETDATA doesn't prevent processing of future messages")
3834

3935
# Send invalid message and verify that node responds to later ping
4036
invalid_getdata = msg_getdata()
4137
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)
4339

4440
# Check getdata still works by fetching tip block
4541
best_block = int(self.nodes[0].getbestblockhash(), 16)
4642
good_getdata = msg_getdata()
4743
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)
5046

5147

5248
if __name__ == '__main__':

0 commit comments

Comments
 (0)