mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 14:53:03 +02:00
Merge #15990: Add tests and documentation for blocksonly
fa8ced32a6
doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke)fa320de79f
test: Add test for p2p_blocksonly (MarcoFalke)fa3872e7b4
test: Format predicate source as multiline on error (MarcoFalke)fa1dce7329
net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACKfa8ced32a6
Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
This commit is contained in:
@@ -361,6 +361,14 @@ class P2PInterface(P2PConnection):
|
||||
|
||||
# Message receiving helper methods
|
||||
|
||||
def wait_for_tx(self, txid, timeout=60):
|
||||
def test_function():
|
||||
if not self.last_message.get('tx'):
|
||||
return False
|
||||
return self.last_message['tx'].tx.rehash() == txid
|
||||
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
||||
def wait_for_block(self, blockhash, timeout=60):
|
||||
test_function = lambda: self.last_message.get("block") and self.last_message["block"].block.rehash() == blockhash
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
@@ -216,7 +216,7 @@ def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=N
|
||||
time.sleep(0.05)
|
||||
|
||||
# Print the cause of the timeout
|
||||
predicate_source = inspect.getsourcelines(predicate)
|
||||
predicate_source = "''''\n" + inspect.getsource(predicate) + "'''"
|
||||
logger.error("wait_until() failed. Predicate: {}".format(predicate_source))
|
||||
if attempt >= attempts:
|
||||
raise AssertionError("Predicate {} not true after {} attempts".format(predicate_source, attempts))
|
||||
|
Reference in New Issue
Block a user