mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-24 22:09:20 +02:00
Merge bitcoin/bitcoin#30072: refactor prep for package rbf
2fd34ba504Add sanity checks for various ATMPArgs booleans (Greg Sanders)20d8936d8b[refactor] make some members MemPoolAccept-wide (glozow)cbbfe719b2cpfp carveout is excluded in packages (glozow)69f7ab05baAdd m_allow_sibling_eviction as separate ATMPArgs flag (Greg Sanders)57ee3029ddAdd description for m_test_accept (Greg Sanders) Pull request description: First few commits of https://github.com/bitcoin/bitcoin/pull/28984 to set the stage for the package RBF logic. These refactors are preparation for evaluating an RBF in a multi-proposed-transaction context instead of only a single proposed transaction. Also, carveouts and sibling evictions only should work in single RBF cases so add logic to preclude multi-tx cases in the future. No behavior changes aside from bailing earlier from failed carve-outs. ACKs for top commit: glozow: reACK2fd34ba504via range-diff sr-gi: utACK [2fd34ba](2fd34ba504) theStack: re-ACK2fd34ba504Tree-SHA512: 5071c5b8d9b8d2c9faa278c8c4df31de288cb407a68e4d55544c588caff6c86160cce7825453549c6ed69e29d9ccb5ee2d4a518b18f563bfb12f2ced073fe42a
This commit is contained in:
@@ -47,21 +47,30 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
|
||||
# Adding one more transaction on to the chain should fail.
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many unconfirmed ancestors [limit: 25]", self.chain_tx, [utxo])
|
||||
# ...even if it chains on from some point in the middle of the chain.
|
||||
# ... or if it chains on from some point in the middle of the chain.
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many descendants", self.chain_tx, [chain[2]])
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many descendants", self.chain_tx, [chain[1]])
|
||||
# ...even if it chains on to two parent transactions with one in the chain.
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many descendants", self.chain_tx, [chain[0], second_chain])
|
||||
# ...especially if its > 40k weight
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many descendants", self.chain_tx, [chain[0]], num_outputs=350)
|
||||
# ...even if it's submitted with other transactions
|
||||
replaceable_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=[chain[0]])
|
||||
txns = [replaceable_tx["tx"], self.wallet.create_self_transfer_multi(utxos_to_spend=replaceable_tx["new_utxos"])["tx"]]
|
||||
txns_hex = [tx.serialize().hex() for tx in txns]
|
||||
assert_equal(self.nodes[0].testmempoolaccept(txns_hex)[0]["reject-reason"], "too-long-mempool-chain")
|
||||
pkg_result = self.nodes[0].submitpackage(txns_hex)
|
||||
assert "too-long-mempool-chain" in pkg_result["tx-results"][txns[0].getwtxid()]["error"]
|
||||
assert_equal(pkg_result["tx-results"][txns[1].getwtxid()]["error"], "bad-txns-inputs-missingorspent")
|
||||
# But not if it chains directly off the first transaction
|
||||
replacable_tx = self.wallet.send_self_transfer_multi(from_node=self.nodes[0], utxos_to_spend=[chain[0]])['tx']
|
||||
self.nodes[0].sendrawtransaction(replaceable_tx["hex"])
|
||||
# and the second chain should work just fine
|
||||
self.chain_tx([second_chain])
|
||||
|
||||
# Make sure we can RBF the chain which used our carve-out rule
|
||||
replacable_tx.vout[0].nValue -= 1000000
|
||||
self.nodes[0].sendrawtransaction(replacable_tx.serialize().hex())
|
||||
# Ensure an individual transaction with single direct conflict can RBF the chain which used our carve-out rule
|
||||
replacement_tx = replaceable_tx["tx"]
|
||||
replacement_tx.vout[0].nValue -= 1000000
|
||||
self.nodes[0].sendrawtransaction(replacement_tx.serialize().hex())
|
||||
|
||||
# Finally, check that we added two transactions
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), DEFAULT_ANCESTOR_LIMIT + 3)
|
||||
|
||||
Reference in New Issue
Block a user