diff options
Diffstat (limited to 'test/functional/p2p_invalid_tx.py')
-rwxr-xr-x | test/functional/p2p_invalid_tx.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/p2p_invalid_tx.py b/test/functional/p2p_invalid_tx.py index a12c1d6023..d050bd2bfd 100755 --- a/test/functional/p2p_invalid_tx.py +++ b/test/functional/p2p_invalid_tx.py @@ -21,6 +21,8 @@ from test_framework.util import ( ) +REJECT_INVALID = 16 + class InvalidTxRequestTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 @@ -71,7 +73,7 @@ class InvalidTxRequestTest(BitcoinTestFramework): # and we get disconnected immediately self.log.info('Test a transaction that is rejected') tx1 = create_transaction(block1.vtx[0], 0, b'\x64' * 35, 50 * COIN - 12000) - node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True) + node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True, reject_code=REJECT_INVALID, reject_reason=b'mandatory-script-verify-flag-failed (Invalid OP_IF construction)') # Make two p2p connections to provide the node with orphans # * p2ps[0] will send valid orphan txs (one with low fee) @@ -137,6 +139,13 @@ class InvalidTxRequestTest(BitcoinTestFramework): wait_until(lambda: 1 == len(node.getpeerinfo()), timeout=12) # p2ps[1] is no longer connected assert_equal(expected_mempool, set(node.getrawmempool())) + # restart node with sending BIP61 messages disabled, check that it disconnects without sending the reject message + self.log.info('Test a transaction that is rejected, with BIP61 disabled') + self.restart_node(0, ['-enablebip61=0','-persistmempool=0']) + self.reconnect_p2p(num_connections=1) + node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True) + # send_txs_and_test will have waited for disconnect, so we can safely check that no reject has been received + assert_equal(node.p2p.reject_code_received, None) if __name__ == '__main__': InvalidTxRequestTest().main() |