diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-05-14 14:00:16 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-05-14 14:21:38 +0200 |
commit | 3cbd25f9bfbec44d7ae3f866908485d236ff163c (patch) | |
tree | 08fd1f6e4aa76a5697b52f36674d5fc5a66eae92 /test | |
parent | e03c0db08f3bc87cdca2723007bc62831563cfd5 (diff) | |
parent | 7384a3584929c3650a191d34d09f54e7ec828597 (diff) |
Merge #13205: [tests] Remove spurious error log in p2p_segwit.py
7384a35 [tests] Remove spurious error log in p2p_segwit.py (John Newbery)
Pull request description:
Since 265d7c44b1aae06aee93f745a865807732218a73, when wait_until() fails,
an error message is logged to the test framework log. This means that if
wait_until() is called inside a try-except with the expectation that it
will fail, a spurious error message is logged.
wait_until() shouldn't be called with the expectation of failure. Fix
that in p2p_segwit.py.
Tree-SHA512: 0a43790b58fee7d2d6bef36e736b0b9ffdde6de5f12d33d15e8e07323597e2be4cd98f17e7fc3a135e06bdafe36613466c0a57e81134e59a251383c62b91918f
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/p2p_segwit.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index ac5367a222..e80a764477 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -73,11 +73,15 @@ class TestP2PConn(P2PInterface): for inv in message.inv: self.getdataset.add(inv.hash) - def announce_tx_and_wait_for_getdata(self, tx, timeout=60): + def announce_tx_and_wait_for_getdata(self, tx, timeout=60, success=True): with mininode_lock: self.last_message.pop("getdata", None) self.send_message(msg_inv(inv=[CInv(1, tx.sha256)])) - self.wait_for_getdata(timeout) + if success: + self.wait_for_getdata(timeout) + else: + time.sleep(timeout) + assert not self.last_message.get("getdata") def announce_block_and_wait_for_getdata(self, block, use_header, timeout=60): with mininode_lock: @@ -908,12 +912,7 @@ class SegWitTest(BitcoinTestFramework): # Since we haven't delivered the tx yet, inv'ing the same tx from # a witness transaction ought not result in a getdata. - try: - self.test_node.announce_tx_and_wait_for_getdata(tx, timeout=2) - self.log.error("Error: duplicate tx getdata!") - assert(False) - except AssertionError: - pass + self.test_node.announce_tx_and_wait_for_getdata(tx, timeout=2, success=False) # Delivering this transaction with witness should fail (no matter who # its from) |