mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
[test] package cpfp bumps parents <mempoolminfee but >=minrelaytxfee
This commit is contained in:
@ -20,7 +20,6 @@ from test_framework.util import (
|
||||
assert_raises_rpc_error,
|
||||
)
|
||||
from test_framework.wallet import (
|
||||
COIN,
|
||||
DEFAULT_FEE,
|
||||
MiniWallet,
|
||||
)
|
||||
@ -325,42 +324,6 @@ class RPCPackagesTest(BitcoinTestFramework):
|
||||
peer.wait_for_broadcast([tx["tx"].getwtxid() for tx in package_txns])
|
||||
self.generate(node, 1)
|
||||
|
||||
def test_submit_cpfp(self):
|
||||
node = self.nodes[0]
|
||||
peer = node.add_p2p_connection(P2PTxInvStore())
|
||||
|
||||
# Package with 2 parents and 1 child. One parent pays for itself using modified fees, and
|
||||
# another has 0 fees but is bumped by child.
|
||||
tx_poor = self.wallet.create_self_transfer(fee=0, fee_rate=0)
|
||||
tx_rich = self.wallet.create_self_transfer(fee=0, fee_rate=0)
|
||||
node.prioritisetransaction(tx_rich["txid"], 0, int(DEFAULT_FEE * COIN))
|
||||
package_txns = [tx_rich, tx_poor]
|
||||
coins = [tx["new_utxo"] for tx in package_txns]
|
||||
tx_child = self.wallet.create_self_transfer_multi(utxos_to_spend=coins, fee_per_output=10000) #DEFAULT_FEE
|
||||
package_txns.append(tx_child)
|
||||
|
||||
submitpackage_result = node.submitpackage([tx["hex"] for tx in package_txns])
|
||||
|
||||
rich_parent_result = submitpackage_result["tx-results"][tx_rich["wtxid"]]
|
||||
poor_parent_result = submitpackage_result["tx-results"][tx_poor["wtxid"]]
|
||||
child_result = submitpackage_result["tx-results"][tx_child["tx"].getwtxid()]
|
||||
assert_equal(rich_parent_result["fees"]["base"], 0)
|
||||
assert_equal(poor_parent_result["fees"]["base"], 0)
|
||||
assert_equal(child_result["fees"]["base"], DEFAULT_FEE)
|
||||
# The "rich" parent does not require CPFP so its effective feerate.
|
||||
assert_fee_amount(DEFAULT_FEE, tx_rich["tx"].get_vsize(), rich_parent_result["fees"]["effective-feerate"])
|
||||
assert_equal(rich_parent_result["fees"]["effective-includes"], [tx_rich["wtxid"]])
|
||||
# The "poor" parent and child's effective feerates are the same, composed of the child's fee
|
||||
# divided by their combined vsize.
|
||||
assert_fee_amount(DEFAULT_FEE, tx_poor["tx"].get_vsize() + tx_child["tx"].get_vsize(), poor_parent_result["fees"]["effective-feerate"])
|
||||
assert_fee_amount(DEFAULT_FEE, tx_poor["tx"].get_vsize() + tx_child["tx"].get_vsize(), child_result["fees"]["effective-feerate"])
|
||||
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], poor_parent_result["fees"]["effective-includes"])
|
||||
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], child_result["fees"]["effective-includes"])
|
||||
|
||||
# The node will broadcast each transaction, still abiding by its peer's fee filter
|
||||
peer.wait_for_broadcast([tx["tx"].getwtxid() for tx in package_txns])
|
||||
self.generate(node, 1)
|
||||
|
||||
def test_submitpackage(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
@ -369,9 +332,6 @@ class RPCPackagesTest(BitcoinTestFramework):
|
||||
self.test_submit_child_with_parents(num_parents, False)
|
||||
self.test_submit_child_with_parents(num_parents, True)
|
||||
|
||||
self.log.info("Submitpackage valid packages with CPFP")
|
||||
self.test_submit_cpfp()
|
||||
|
||||
self.log.info("Submitpackage only allows packages of 1 child with its parents")
|
||||
# Chain of 3 transactions has too many generations
|
||||
chain_hex = [t["hex"] for t in self.wallet.create_self_transfer_chain(chain_length=25)]
|
||||
|
Reference in New Issue
Block a user