test: makes timeout a forced named argument in tests methods that use it

This makes calls to such methods more explicit and less error prone
This commit is contained in:
Sergi Delgado Segura
2024-03-27 13:35:53 +01:00
parent 19b968f743
commit 61560d5e93
5 changed files with 22 additions and 22 deletions

View File

@ -198,15 +198,15 @@ class TestP2PConn(P2PInterface):
self.send_message(msg)
else:
self.send_message(msg_inv(inv=[CInv(MSG_BLOCK, block.sha256)]))
self.wait_for_getheaders()
self.wait_for_getheaders(timeout=timeout)
self.send_message(msg)
self.wait_for_getdata([block.sha256])
self.wait_for_getdata([block.sha256], timeout=timeout)
def request_block(self, blockhash, inv_type, timeout=60):
with p2p_lock:
self.last_message.pop("block", None)
self.send_message(msg_getdata(inv=[CInv(inv_type, blockhash)]))
self.wait_for_block(blockhash, timeout)
self.wait_for_block(blockhash, timeout=timeout)
return self.last_message["block"].block
class SegWitTest(BitcoinTestFramework):
@ -2056,7 +2056,7 @@ class SegWitTest(BitcoinTestFramework):
test_transaction_acceptance(self.nodes[0], self.wtx_node, tx2, with_witness=True, accepted=False)
# Expect a request for parent (tx) by txid despite use of WTX peer
self.wtx_node.wait_for_getdata([tx.sha256], 60)
self.wtx_node.wait_for_getdata([tx.sha256], timeout=60)
with p2p_lock:
lgd = self.wtx_node.lastgetdata[:]
assert_equal(lgd, [CInv(MSG_WITNESS_TX, tx.sha256)])