test: Add test for p2p_blocksonly

This commit is contained in:
MarcoFalke
2019-05-09 10:42:56 -04:00
parent fa3872e7b4
commit fa320de79f
3 changed files with 67 additions and 0 deletions

View File

@@ -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)