Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_avalanche_transaction_voting.py
| Show First 20 Lines • Show All 538 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
| self.wait_until(lambda: has_invalidated_tx(conflicting_tx["txid"])) | self.wait_until(lambda: has_invalidated_tx(conflicting_tx["txid"])) | ||||
| assert mempool_tx["txid"] in node.getrawmempool() | assert mempool_tx["txid"] in node.getrawmempool() | ||||
| assert conflicting_tx["txid"] not in node.getrawmempool() | assert conflicting_tx["txid"] not in node.getrawmempool() | ||||
| # Now that the conflicting_tx has been invalidated, it will be ignored | # Now that the conflicting_tx has been invalidated, it will be ignored | ||||
| # if submitted again because it's in the recent rejects | # if submitted again because it's in the recent rejects | ||||
| peer.send_txs_and_test( | peer.send_txs_and_test( | ||||
| [conflicting_tx_obj], node, success=False, expect_disconnect=False | [conflicting_tx_obj], | ||||
| node, | |||||
| success=False, | |||||
| ) | ) | ||||
| # mempool_tx is not finalized so we accept another conflicting tx | # mempool_tx is not finalized so we accept another conflicting tx | ||||
| another_conflicting_tx = wallet.create_self_transfer( | another_conflicting_tx = wallet.create_self_transfer( | ||||
| utxo_to_spend=utxo, fee_rate=Decimal("4000") | utxo_to_spend=utxo, fee_rate=Decimal("4000") | ||||
| ) | ) | ||||
| another_conflicting_tx_obj = from_wallet_tx(another_conflicting_tx) | another_conflicting_tx_obj = from_wallet_tx(another_conflicting_tx) | ||||
| with node.assert_debug_log( | with node.assert_debug_log( | ||||
| [f"stored conflicting tx {another_conflicting_tx['txid']}"] | [f"stored conflicting tx {another_conflicting_tx['txid']}"] | ||||
| ): | ): | ||||
| peer.send_txs_and_test( | peer.send_txs_and_test( | ||||
| [another_conflicting_tx_obj], | [another_conflicting_tx_obj], | ||||
| node, | node, | ||||
| success=False, | success=False, | ||||
| expect_disconnect=False, | |||||
| reject_reason="txn-mempool-conflict", | reject_reason="txn-mempool-conflict", | ||||
| ) | ) | ||||
| assert mempool_tx["txid"] in node.getrawmempool() | assert mempool_tx["txid"] in node.getrawmempool() | ||||
| assert another_conflicting_tx["txid"] not in node.getrawmempool() | assert another_conflicting_tx["txid"] not in node.getrawmempool() | ||||
| # We can now invalidate both transactions and they will both be removed | # We can now invalidate both transactions and they will both be removed | ||||
| # from all the pools independently of where they used to be. The | # from all the pools independently of where they used to be. The | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
| assert conflicting_tx["txid"] not in node.getrawmempool() | assert conflicting_tx["txid"] not in node.getrawmempool() | ||||
| assert_equal( | assert_equal( | ||||
| node.gettransactionstatus(conflicting_tx["txid"])["pool"], "none" | node.gettransactionstatus(conflicting_tx["txid"])["pool"], "none" | ||||
| ) | ) | ||||
| # Sending them again will not add them back because they're all in | # Sending them again will not add them back because they're all in | ||||
| # the recent_reject | # the recent_reject | ||||
| conflicting_tx_obj = from_wallet_tx(conflicting_tx) | conflicting_tx_obj = from_wallet_tx(conflicting_tx) | ||||
| peer.send_txs_and_test( | peer.send_txs_and_test([conflicting_tx_obj], node, success=False) | ||||
| [conflicting_tx_obj], node, success=False, expect_disconnect=False | |||||
| ) | |||||
| # A new conflict is rejected because it conflicts with the finalized tx | # A new conflict is rejected because it conflicts with the finalized tx | ||||
| another_conflicting_tx = wallet.create_self_transfer( | another_conflicting_tx = wallet.create_self_transfer( | ||||
| utxo_to_spend=utxo, fee_rate=Decimal("4000") | utxo_to_spend=utxo, fee_rate=Decimal("4000") | ||||
| ) | ) | ||||
| another_conflicting_tx_obj = from_wallet_tx(another_conflicting_tx) | another_conflicting_tx_obj = from_wallet_tx(another_conflicting_tx) | ||||
| with node.assert_debug_log( | with node.assert_debug_log( | ||||
| ["finalized-tx-conflict"], | ["finalized-tx-conflict"], | ||||
| [f"stored conflicting tx {another_conflicting_tx['txid']}"], | [f"stored conflicting tx {another_conflicting_tx['txid']}"], | ||||
| ): | ): | ||||
| peer.send_txs_and_test( | peer.send_txs_and_test( | ||||
| [another_conflicting_tx_obj], | [another_conflicting_tx_obj], | ||||
| node, | node, | ||||
| success=False, | success=False, | ||||
| expect_disconnect=False, | |||||
| reject_reason="finalized-tx-conflict", | reject_reason="finalized-tx-conflict", | ||||
| ) | ) | ||||
| self.log.info("Check the node drops staled transactions") | self.log.info("Check the node drops staled transactions") | ||||
| tip = self.generate(wallet, 1)[0] | tip = self.generate(wallet, 1)[0] | ||||
| assert_equal(node.getrawmempool(), []) | assert_equal(node.getrawmempool(), []) | ||||
| ▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines | |||||