Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_invalid_tx.py
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
tx_withhold, # The transaction that is the root for all orphans | tx_withhold, # The transaction that is the root for all orphans | ||||
tx_orphan_1, # The orphan transaction that splits the coins | tx_orphan_1, # The orphan transaction that splits the coins | ||||
# The valid transaction (with sufficient fee) | # The valid transaction (with sufficient fee) | ||||
tx_orphan_2_valid, | tx_orphan_2_valid, | ||||
] | ] | ||||
} | } | ||||
# Transactions that do not end up in the mempool | # Transactions that do not end up in the mempool | ||||
# tx_orphan_no_fee, because it has too low fee (p2ps[0] is not disconnected for relaying that tx) | # tx_orphan_no_fee, because it has too low fee (p2ps[0] is not disconnected for relaying that tx) | ||||
# tx_orphan_invaid, because it has negative fee (p2ps[1] is disconnected for relaying that tx) | # tx_orphan_invaid, because it has negative fee (p2ps[1] is | ||||
# disconnected for relaying that tx) | |||||
# p2ps[1] is no longer connected | # p2ps[1] is no longer connected | ||||
wait_until(lambda: 1 == len(node.getpeerinfo()), timeout=12) | wait_until(lambda: 1 == len(node.getpeerinfo()), timeout=12) | ||||
assert_equal(expected_mempool, set(node.getrawmempool())) | assert_equal(expected_mempool, set(node.getrawmempool())) | ||||
# restart node with sending BIP61 messages disabled, check that it disconnects without sending the reject message | # restart node with sending BIP61 messages disabled, check that it | ||||
# disconnects without sending the reject message | |||||
self.log.info( | self.log.info( | ||||
'Test a transaction that is rejected, with BIP61 disabled') | 'Test a transaction that is rejected, with BIP61 disabled') | ||||
self.restart_node(0, ['-enablebip61=0', '-persistmempool=0']) | self.restart_node(0, ['-enablebip61=0', '-persistmempool=0']) | ||||
self.reconnect_p2p(num_connections=1) | self.reconnect_p2p(num_connections=1) | ||||
node.p2p.send_txs_and_test( | node.p2p.send_txs_and_test( | ||||
[tx1], node, success=False, reject_reason="{} from peer=0 was not accepted: mandatory-script-verify-flag-failed (Invalid OP_IF construction) (code 16)".format(tx1.hash), expect_disconnect=True) | [tx1], node, success=False, reject_reason="{} from peer=0 was not accepted: mandatory-script-verify-flag-failed (Invalid OP_IF construction) (code 16)".format(tx1.hash), expect_disconnect=True) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
InvalidTxRequestTest().main() | InvalidTxRequestTest().main() |