mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-09 21:47:34 +01:00
Merge bitcoin/bitcoin#30272: doc: use TRUC instead of v3 and add release note
926b8e39dc[doc] add release note for TRUC (glozow)19a9b90617use version=3 instead of v3 in debug strings (glozow)881fac8e60scripted-diff: change names from V3 to TRUC (glozow)a573dd2617[doc] replace mentions of v3 with TRUC (glozow)089b5757dfrename mempool_accept_v3.py to mempool_truc.py (glozow)f543852a89rename policy/v3_policy.* to policy/truc_policy.* (glozow) Pull request description: Adds a release note for TRUC policy which will be live in v28.0. For clarity, replaces mentions of "v3" with "TRUC" in most places. Suggested in - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1629749583 - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1624500904 I changed error strings from "v3-violation" to "TRUC-violation" but left v3 in the debug strings because I think it might be clearer for somebody who is debugging. Similarly, I left some variables unchanged because I think they're more descriptive this way, e.g. `tx_v3_from_v2_and_v3`. I'm happy to debate places that should or shouldn't be documented differently in this PR, whatever is clearest to everyone. ACKs for top commit: instagibbs: reACK926b8e39dcachow101: ACK926b8e39dcismaelsadeeq: Code review ACK926b8e39dcTree-SHA512: 16c88add0a29dc6d1236c4d45f34a17b850f6727b231953cbd52eb9f7268d1d802563eadfc8b7928c94ed3d7a615275dd103e57e81439ebf3ba2b12efa1e42af
This commit is contained in:
@@ -22,7 +22,7 @@ from test_framework.wallet import (
|
||||
)
|
||||
|
||||
MAX_REPLACEMENT_CANDIDATES = 100
|
||||
V3_MAX_VSIZE = 10000
|
||||
TRUC_MAX_VSIZE = 10000
|
||||
|
||||
def cleanup(extra_args=None):
|
||||
def decorator(func):
|
||||
@@ -39,7 +39,7 @@ def cleanup(extra_args=None):
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
class MempoolAcceptV3(BitcoinTestFramework):
|
||||
class MempoolTRUC(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [[]]
|
||||
@@ -52,23 +52,23 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
assert all([txid in txids for txid in mempool_contents])
|
||||
|
||||
@cleanup(extra_args=["-datacarriersize=20000"])
|
||||
def test_v3_max_vsize(self):
|
||||
def test_truc_max_vsize(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test v3-specific maximum transaction vsize")
|
||||
tx_v3_heavy = self.wallet.create_self_transfer(target_weight=(V3_MAX_VSIZE + 1) * WITNESS_SCALE_FACTOR, version=3)
|
||||
assert_greater_than_or_equal(tx_v3_heavy["tx"].get_vsize(), V3_MAX_VSIZE)
|
||||
expected_error_heavy = f"v3-rule-violation, v3 tx {tx_v3_heavy['txid']} (wtxid={tx_v3_heavy['wtxid']}) is too big"
|
||||
self.log.info("Test TRUC-specific maximum transaction vsize")
|
||||
tx_v3_heavy = self.wallet.create_self_transfer(target_weight=(TRUC_MAX_VSIZE + 1) * WITNESS_SCALE_FACTOR, version=3)
|
||||
assert_greater_than_or_equal(tx_v3_heavy["tx"].get_vsize(), TRUC_MAX_VSIZE)
|
||||
expected_error_heavy = f"TRUC-violation, version=3 tx {tx_v3_heavy['txid']} (wtxid={tx_v3_heavy['wtxid']}) is too big"
|
||||
assert_raises_rpc_error(-26, expected_error_heavy, node.sendrawtransaction, tx_v3_heavy["hex"])
|
||||
self.check_mempool([])
|
||||
|
||||
# Ensure we are hitting the v3-specific limit and not something else
|
||||
tx_v2_heavy = self.wallet.send_self_transfer(from_node=node, target_weight=(V3_MAX_VSIZE + 1) * WITNESS_SCALE_FACTOR, version=2)
|
||||
# Ensure we are hitting the TRUC-specific limit and not something else
|
||||
tx_v2_heavy = self.wallet.send_self_transfer(from_node=node, target_weight=(TRUC_MAX_VSIZE + 1) * WITNESS_SCALE_FACTOR, version=2)
|
||||
self.check_mempool([tx_v2_heavy["txid"]])
|
||||
|
||||
@cleanup(extra_args=["-datacarriersize=1000"])
|
||||
def test_v3_acceptance(self):
|
||||
def test_truc_acceptance(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test a child of a v3 transaction cannot be more than 1000vB")
|
||||
self.log.info("Test a child of a TRUC transaction cannot be more than 1000vB")
|
||||
tx_v3_parent_normal = self.wallet.send_self_transfer(from_node=node, version=3)
|
||||
self.check_mempool([tx_v3_parent_normal["txid"]])
|
||||
tx_v3_child_heavy = self.wallet.create_self_transfer(
|
||||
@@ -77,13 +77,13 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
version=3
|
||||
)
|
||||
assert_greater_than_or_equal(tx_v3_child_heavy["tx"].get_vsize(), 1000)
|
||||
expected_error_child_heavy = f"v3-rule-violation, v3 child tx {tx_v3_child_heavy['txid']} (wtxid={tx_v3_child_heavy['wtxid']}) is too big"
|
||||
expected_error_child_heavy = f"TRUC-violation, version=3 child tx {tx_v3_child_heavy['txid']} (wtxid={tx_v3_child_heavy['wtxid']}) is too big"
|
||||
assert_raises_rpc_error(-26, expected_error_child_heavy, node.sendrawtransaction, tx_v3_child_heavy["hex"])
|
||||
self.check_mempool([tx_v3_parent_normal["txid"]])
|
||||
# tx has no descendants
|
||||
assert_equal(node.getmempoolentry(tx_v3_parent_normal["txid"])["descendantcount"], 1)
|
||||
|
||||
self.log.info("Test that, during replacements, only the new transaction counts for v3 descendant limit")
|
||||
self.log.info("Test that, during replacements, only the new transaction counts for TRUC descendant limit")
|
||||
tx_v3_child_almost_heavy = self.wallet.send_self_transfer(
|
||||
from_node=node,
|
||||
fee_rate=DEFAULT_FEE,
|
||||
@@ -106,9 +106,9 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
assert_equal(node.getmempoolentry(tx_v3_parent_normal["txid"])["descendantcount"], 2)
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
def test_v3_replacement(self):
|
||||
def test_truc_replacement(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test v3 transactions may be replaced by v3 transactions")
|
||||
self.log.info("Test TRUC transactions may be replaced by TRUC transactions")
|
||||
utxo_v3_bip125 = self.wallet.get_utxo()
|
||||
tx_v3_bip125 = self.wallet.send_self_transfer(
|
||||
from_node=node,
|
||||
@@ -127,7 +127,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
)
|
||||
self.check_mempool([tx_v3_bip125_rbf["txid"]])
|
||||
|
||||
self.log.info("Test v3 transactions may be replaced by V2 transactions")
|
||||
self.log.info("Test TRUC transactions may be replaced by non-TRUC (BIP125) transactions")
|
||||
tx_v3_bip125_rbf_v2 = self.wallet.send_self_transfer(
|
||||
from_node=node,
|
||||
fee_rate=DEFAULT_FEE * 3,
|
||||
@@ -136,7 +136,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
)
|
||||
self.check_mempool([tx_v3_bip125_rbf_v2["txid"]])
|
||||
|
||||
self.log.info("Test that replacements cannot cause violation of inherited v3")
|
||||
self.log.info("Test that replacements cannot cause violation of inherited TRUC")
|
||||
utxo_v3_parent = self.wallet.get_utxo()
|
||||
tx_v3_parent = self.wallet.send_self_transfer(
|
||||
from_node=node,
|
||||
@@ -157,15 +157,15 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
utxo_to_spend=tx_v3_parent["new_utxo"],
|
||||
version=2
|
||||
)
|
||||
expected_error_v2_v3 = f"v3-rule-violation, non-v3 tx {tx_v3_child_rbf_v2['txid']} (wtxid={tx_v3_child_rbf_v2['wtxid']}) cannot spend from v3 tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']})"
|
||||
expected_error_v2_v3 = f"TRUC-violation, non-version=3 tx {tx_v3_child_rbf_v2['txid']} (wtxid={tx_v3_child_rbf_v2['wtxid']}) cannot spend from version=3 tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']})"
|
||||
assert_raises_rpc_error(-26, expected_error_v2_v3, node.sendrawtransaction, tx_v3_child_rbf_v2["hex"])
|
||||
self.check_mempool([tx_v3_bip125_rbf_v2["txid"], tx_v3_parent["txid"], tx_v3_child["txid"]])
|
||||
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
def test_v3_bip125(self):
|
||||
def test_truc_bip125(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test v3 transactions that don't signal BIP125 are replaceable")
|
||||
self.log.info("Test TRUC transactions that don't signal BIP125 are replaceable")
|
||||
assert_equal(node.getmempoolinfo()["fullrbf"], False)
|
||||
utxo_v3_no_bip125 = self.wallet.get_utxo()
|
||||
tx_v3_no_bip125 = self.wallet.send_self_transfer(
|
||||
@@ -187,9 +187,9 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
self.check_mempool([tx_v3_no_bip125_rbf["txid"]])
|
||||
|
||||
@cleanup(extra_args=["-datacarriersize=40000"])
|
||||
def test_v3_reorg(self):
|
||||
def test_truc_reorg(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test that, during a reorg, v3 rules are not enforced")
|
||||
self.log.info("Test that, during a reorg, TRUC rules are not enforced")
|
||||
tx_v2_block = self.wallet.send_self_transfer(from_node=node, version=2)
|
||||
tx_v3_block = self.wallet.send_self_transfer(from_node=node, version=3)
|
||||
tx_v3_block2 = self.wallet.send_self_transfer(from_node=node, version=3)
|
||||
@@ -211,12 +211,12 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
@cleanup(extra_args=["-limitdescendantsize=10", "-datacarriersize=40000"])
|
||||
def test_nondefault_package_limits(self):
|
||||
"""
|
||||
Max standard tx size + v3 rules imply the ancestor/descendant rules (at their default
|
||||
Max standard tx size + TRUC rules imply the ancestor/descendant rules (at their default
|
||||
values), but those checks must not be skipped. Ensure both sets of checks are done by
|
||||
changing the ancestor/descendant limit configurations.
|
||||
"""
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test that a decreased limitdescendantsize also applies to v3 child")
|
||||
self.log.info("Test that a decreased limitdescendantsize also applies to TRUC child")
|
||||
parent_target_weight = 9990 * WITNESS_SCALE_FACTOR
|
||||
child_target_weight = 500 * WITNESS_SCALE_FACTOR
|
||||
tx_v3_parent_large1 = self.wallet.send_self_transfer(
|
||||
@@ -231,7 +231,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
)
|
||||
|
||||
# Parent and child are within v3 limits, but parent's 10kvB descendant limit is exceeded
|
||||
assert_greater_than_or_equal(V3_MAX_VSIZE, tx_v3_parent_large1["tx"].get_vsize())
|
||||
assert_greater_than_or_equal(TRUC_MAX_VSIZE, tx_v3_parent_large1["tx"].get_vsize())
|
||||
assert_greater_than_or_equal(1000, tx_v3_child_large1["tx"].get_vsize())
|
||||
assert_greater_than(tx_v3_parent_large1["tx"].get_vsize() + tx_v3_child_large1["tx"].get_vsize(), 10000)
|
||||
|
||||
@@ -253,8 +253,8 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
version=3
|
||||
)
|
||||
|
||||
# Parent and child are within v3 limits
|
||||
assert_greater_than_or_equal(V3_MAX_VSIZE, tx_v3_parent_large2["tx"].get_vsize())
|
||||
# Parent and child are within TRUC limits
|
||||
assert_greater_than_or_equal(TRUC_MAX_VSIZE, tx_v3_parent_large2["tx"].get_vsize())
|
||||
assert_greater_than_or_equal(1000, tx_v3_child_large2["tx"].get_vsize())
|
||||
assert_greater_than(tx_v3_parent_large2["tx"].get_vsize() + tx_v3_child_large2["tx"].get_vsize(), 10000)
|
||||
|
||||
@@ -262,8 +262,8 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
self.check_mempool([tx_v3_parent_large2["txid"]])
|
||||
|
||||
@cleanup(extra_args=["-datacarriersize=1000"])
|
||||
def test_v3_ancestors_package(self):
|
||||
self.log.info("Test that v3 ancestor limits are checked within the package")
|
||||
def test_truc_ancestors_package(self):
|
||||
self.log.info("Test that TRUC ancestor limits are checked within the package")
|
||||
node = self.nodes[0]
|
||||
tx_v3_parent_normal = self.wallet.create_self_transfer(
|
||||
fee_rate=0,
|
||||
@@ -289,34 +289,34 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
|
||||
self.check_mempool([])
|
||||
result = node.submitpackage([tx_v3_parent_normal["hex"], tx_v3_parent_2_normal["hex"], tx_v3_child_multiparent["hex"]])
|
||||
assert_equal(result['package_msg'], f"v3-violation, tx {tx_v3_child_multiparent['txid']} (wtxid={tx_v3_child_multiparent['wtxid']}) would have too many ancestors")
|
||||
assert_equal(result['package_msg'], f"TRUC-violation, tx {tx_v3_child_multiparent['txid']} (wtxid={tx_v3_child_multiparent['wtxid']}) would have too many ancestors")
|
||||
self.check_mempool([])
|
||||
|
||||
self.check_mempool([])
|
||||
result = node.submitpackage([tx_v3_parent_normal["hex"], tx_v3_child_heavy["hex"]])
|
||||
# tx_v3_child_heavy is heavy based on weight, not sigops.
|
||||
assert_equal(result['package_msg'], f"v3-violation, v3 child tx {tx_v3_child_heavy['txid']} (wtxid={tx_v3_child_heavy['wtxid']}) is too big: {tx_v3_child_heavy['tx'].get_vsize()} > 1000 virtual bytes")
|
||||
assert_equal(result['package_msg'], f"TRUC-violation, version=3 child tx {tx_v3_child_heavy['txid']} (wtxid={tx_v3_child_heavy['wtxid']}) is too big: {tx_v3_child_heavy['tx'].get_vsize()} > 1000 virtual bytes")
|
||||
self.check_mempool([])
|
||||
|
||||
tx_v3_parent = self.wallet.create_self_transfer(version=3)
|
||||
tx_v3_child = self.wallet.create_self_transfer(utxo_to_spend=tx_v3_parent["new_utxo"], version=3)
|
||||
tx_v3_grandchild = self.wallet.create_self_transfer(utxo_to_spend=tx_v3_child["new_utxo"], version=3)
|
||||
result = node.testmempoolaccept([tx_v3_parent["hex"], tx_v3_child["hex"], tx_v3_grandchild["hex"]])
|
||||
assert all([txresult["package-error"] == f"v3-violation, tx {tx_v3_grandchild['txid']} (wtxid={tx_v3_grandchild['wtxid']}) would have too many ancestors" for txresult in result])
|
||||
assert all([txresult["package-error"] == f"TRUC-violation, tx {tx_v3_grandchild['txid']} (wtxid={tx_v3_grandchild['wtxid']}) would have too many ancestors" for txresult in result])
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
def test_v3_ancestors_package_and_mempool(self):
|
||||
def test_truc_ancestors_package_and_mempool(self):
|
||||
"""
|
||||
A v3 transaction in a package cannot have 2 v3 parents.
|
||||
A TRUC transaction in a package cannot have 2 TRUC parents.
|
||||
Test that if we have a transaction graph A -> B -> C, where A, B, C are
|
||||
all v3 transactions, that we cannot use submitpackage to get the
|
||||
all TRUC transactions, that we cannot use submitpackage to get the
|
||||
transactions all into the mempool.
|
||||
|
||||
Verify, in particular, that if A is already in the mempool, then
|
||||
submitpackage(B, C) will fail.
|
||||
"""
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test that v3 ancestor limits include transactions within the package and all in-mempool ancestors")
|
||||
self.log.info("Test that TRUC ancestor limits include transactions within the package and all in-mempool ancestors")
|
||||
# This is our transaction "A":
|
||||
tx_in_mempool = self.wallet.send_self_transfer(from_node=node, version=3)
|
||||
|
||||
@@ -331,7 +331,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
|
||||
# submitpackage(B, C) should fail
|
||||
result = node.submitpackage([tx_0fee_parent["hex"], tx_child_violator["hex"]])
|
||||
assert_equal(result['package_msg'], f"v3-violation, tx {tx_child_violator['txid']} (wtxid={tx_child_violator['wtxid']}) would have too many ancestors")
|
||||
assert_equal(result['package_msg'], f"TRUC-violation, tx {tx_child_violator['txid']} (wtxid={tx_child_violator['wtxid']}) would have too many ancestors")
|
||||
self.check_mempool([tx_in_mempool["txid"]])
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
@@ -341,7 +341,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
However, this option is only available in single transaction acceptance. It doesn't work in
|
||||
a multi-testmempoolaccept (where RBF is disabled) or when doing package CPFP.
|
||||
"""
|
||||
self.log.info("Test v3 sibling eviction in submitpackage and multi-testmempoolaccept")
|
||||
self.log.info("Test TRUC sibling eviction in submitpackage and multi-testmempoolaccept")
|
||||
node = self.nodes[0]
|
||||
# Add a parent + child to mempool
|
||||
tx_mempool_parent = self.wallet.send_self_transfer_multi(
|
||||
@@ -384,17 +384,17 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
# Fails with another non-related transaction via testmempoolaccept
|
||||
tx_unrelated = self.wallet.create_self_transfer(version=3)
|
||||
result_test_unrelated = node.testmempoolaccept([tx_sibling_1["hex"], tx_unrelated["hex"]])
|
||||
assert_equal(result_test_unrelated[0]["reject-reason"], "v3-rule-violation")
|
||||
assert_equal(result_test_unrelated[0]["reject-reason"], "TRUC-violation")
|
||||
|
||||
# Fails in a package via testmempoolaccept
|
||||
result_test_1p1c = node.testmempoolaccept([tx_sibling_1["hex"], tx_has_mempool_uncle["hex"]])
|
||||
assert_equal(result_test_1p1c[0]["reject-reason"], "v3-rule-violation")
|
||||
assert_equal(result_test_1p1c[0]["reject-reason"], "TRUC-violation")
|
||||
|
||||
# Allowed when tx is submitted in a package and evaluated individually.
|
||||
# Note that the child failed since it would be the 3rd generation.
|
||||
result_package_indiv = node.submitpackage([tx_sibling_1["hex"], tx_has_mempool_uncle["hex"]])
|
||||
self.check_mempool([tx_mempool_parent["txid"], tx_sibling_1["txid"]])
|
||||
expected_error_gen3 = f"v3-rule-violation, tx {tx_has_mempool_uncle['txid']} (wtxid={tx_has_mempool_uncle['wtxid']}) would have too many ancestors"
|
||||
expected_error_gen3 = f"TRUC-violation, tx {tx_has_mempool_uncle['txid']} (wtxid={tx_has_mempool_uncle['wtxid']}) would have too many ancestors"
|
||||
|
||||
assert_equal(result_package_indiv["tx-results"][tx_has_mempool_uncle['wtxid']]['error'], expected_error_gen3)
|
||||
|
||||
@@ -402,17 +402,17 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
node.submitpackage([tx_mempool_parent["hex"], tx_sibling_2["hex"]])
|
||||
self.check_mempool([tx_mempool_parent["txid"], tx_sibling_2["txid"]])
|
||||
|
||||
# Child cannot pay for sibling eviction for parent, as it violates v3 topology limits
|
||||
# Child cannot pay for sibling eviction for parent, as it violates TRUC topology limits
|
||||
result_package_cpfp = node.submitpackage([tx_sibling_3["hex"], tx_bumps_parent_with_sibling["hex"]])
|
||||
self.check_mempool([tx_mempool_parent["txid"], tx_sibling_2["txid"]])
|
||||
expected_error_cpfp = f"v3-rule-violation, tx {tx_mempool_parent['txid']} (wtxid={tx_mempool_parent['wtxid']}) would exceed descendant count limit"
|
||||
expected_error_cpfp = f"TRUC-violation, tx {tx_mempool_parent['txid']} (wtxid={tx_mempool_parent['wtxid']}) would exceed descendant count limit"
|
||||
|
||||
assert_equal(result_package_cpfp["tx-results"][tx_sibling_3['wtxid']]['error'], expected_error_cpfp)
|
||||
|
||||
|
||||
@cleanup(extra_args=["-datacarriersize=1000"])
|
||||
def test_v3_package_inheritance(self):
|
||||
self.log.info("Test that v3 inheritance is checked within package")
|
||||
def test_truc_package_inheritance(self):
|
||||
self.log.info("Test that TRUC inheritance is checked within package")
|
||||
node = self.nodes[0]
|
||||
tx_v3_parent = self.wallet.create_self_transfer(
|
||||
fee_rate=0,
|
||||
@@ -426,14 +426,14 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
)
|
||||
self.check_mempool([])
|
||||
result = node.submitpackage([tx_v3_parent["hex"], tx_v2_child["hex"]])
|
||||
assert_equal(result['package_msg'], f"v3-violation, non-v3 tx {tx_v2_child['txid']} (wtxid={tx_v2_child['wtxid']}) cannot spend from v3 tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']})")
|
||||
assert_equal(result['package_msg'], f"TRUC-violation, non-version=3 tx {tx_v2_child['txid']} (wtxid={tx_v2_child['wtxid']}) cannot spend from version=3 tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']})")
|
||||
self.check_mempool([])
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
def test_v3_in_testmempoolaccept(self):
|
||||
def test_truc_in_testmempoolaccept(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
self.log.info("Test that v3 inheritance is accurately assessed in testmempoolaccept")
|
||||
self.log.info("Test that TRUC inheritance is accurately assessed in testmempoolaccept")
|
||||
tx_v2 = self.wallet.create_self_transfer(version=2)
|
||||
tx_v2_from_v2 = self.wallet.create_self_transfer(utxo_to_spend=tx_v2["new_utxo"], version=2)
|
||||
tx_v3_from_v2 = self.wallet.create_self_transfer(utxo_to_spend=tx_v2["new_utxo"], version=3)
|
||||
@@ -447,11 +447,11 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
assert all([result["allowed"] for result in test_accept_v2_and_v3])
|
||||
|
||||
test_accept_v3_from_v2 = node.testmempoolaccept([tx_v2["hex"], tx_v3_from_v2["hex"]])
|
||||
expected_error_v3_from_v2 = f"v3-violation, v3 tx {tx_v3_from_v2['txid']} (wtxid={tx_v3_from_v2['wtxid']}) cannot spend from non-v3 tx {tx_v2['txid']} (wtxid={tx_v2['wtxid']})"
|
||||
expected_error_v3_from_v2 = f"TRUC-violation, version=3 tx {tx_v3_from_v2['txid']} (wtxid={tx_v3_from_v2['wtxid']}) cannot spend from non-version=3 tx {tx_v2['txid']} (wtxid={tx_v2['wtxid']})"
|
||||
assert all([result["package-error"] == expected_error_v3_from_v2 for result in test_accept_v3_from_v2])
|
||||
|
||||
test_accept_v2_from_v3 = node.testmempoolaccept([tx_v3["hex"], tx_v2_from_v3["hex"]])
|
||||
expected_error_v2_from_v3 = f"v3-violation, non-v3 tx {tx_v2_from_v3['txid']} (wtxid={tx_v2_from_v3['wtxid']}) cannot spend from v3 tx {tx_v3['txid']} (wtxid={tx_v3['wtxid']})"
|
||||
expected_error_v2_from_v3 = f"TRUC-violation, non-version=3 tx {tx_v2_from_v3['txid']} (wtxid={tx_v2_from_v3['wtxid']}) cannot spend from version=3 tx {tx_v3['txid']} (wtxid={tx_v3['wtxid']})"
|
||||
assert all([result["package-error"] == expected_error_v2_from_v3 for result in test_accept_v2_from_v3])
|
||||
|
||||
test_accept_pairs = node.testmempoolaccept([tx_v2["hex"], tx_v3["hex"], tx_v2_from_v2["hex"], tx_v3_from_v3["hex"]])
|
||||
@@ -463,16 +463,16 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
tx_v3_child_1 = self.wallet.create_self_transfer(utxo_to_spend=tx_v3_parent["new_utxos"][0], version=3)
|
||||
tx_v3_child_2 = self.wallet.create_self_transfer(utxo_to_spend=tx_v3_parent["new_utxos"][1], version=3)
|
||||
test_accept_2children = node.testmempoolaccept([tx_v3_parent["hex"], tx_v3_child_1["hex"], tx_v3_child_2["hex"]])
|
||||
expected_error_2children = f"v3-violation, tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']}) would exceed descendant count limit"
|
||||
expected_error_2children = f"TRUC-violation, tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']}) would exceed descendant count limit"
|
||||
assert all([result["package-error"] == expected_error_2children for result in test_accept_2children])
|
||||
|
||||
# Extra v3 transaction does not get incorrectly marked as extra descendant
|
||||
# Extra TRUC transaction does not get incorrectly marked as extra descendant
|
||||
test_accept_1child_with_exra = node.testmempoolaccept([tx_v3_parent["hex"], tx_v3_child_1["hex"], tx_v3_independent["hex"]])
|
||||
assert all([result["allowed"] for result in test_accept_1child_with_exra])
|
||||
|
||||
# Extra v3 transaction does not make us ignore the extra descendant
|
||||
# Extra TRUC transaction does not make us ignore the extra descendant
|
||||
test_accept_2children_with_exra = node.testmempoolaccept([tx_v3_parent["hex"], tx_v3_child_1["hex"], tx_v3_child_2["hex"], tx_v3_independent["hex"]])
|
||||
expected_error_extra = f"v3-violation, tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']}) would exceed descendant count limit"
|
||||
expected_error_extra = f"TRUC-violation, tx {tx_v3_parent['txid']} (wtxid={tx_v3_parent['wtxid']}) would exceed descendant count limit"
|
||||
assert all([result["package-error"] == expected_error_extra for result in test_accept_2children_with_exra])
|
||||
# Same result if the parent is already in mempool
|
||||
node.sendrawtransaction(tx_v3_parent["hex"])
|
||||
@@ -482,7 +482,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
@cleanup(extra_args=None)
|
||||
def test_reorg_2child_rbf(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test that children of a v3 transaction can be replaced individually, even if there are multiple due to reorg")
|
||||
self.log.info("Test that children of a TRUC transaction can be replaced individually, even if there are multiple due to reorg")
|
||||
|
||||
ancestor_tx = self.wallet.send_self_transfer_multi(from_node=node, num_outputs=2, version=3)
|
||||
self.check_mempool([ancestor_tx["txid"]])
|
||||
@@ -511,8 +511,8 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
assert_equal(node.getmempoolentry(ancestor_tx["txid"])["descendantcount"], 3)
|
||||
|
||||
@cleanup(extra_args=None)
|
||||
def test_v3_sibling_eviction(self):
|
||||
self.log.info("Test sibling eviction for v3")
|
||||
def test_truc_sibling_eviction(self):
|
||||
self.log.info("Test sibling eviction for TRUC")
|
||||
node = self.nodes[0]
|
||||
tx_v3_parent = self.wallet.send_self_transfer_multi(from_node=node, num_outputs=2, version=3)
|
||||
# This is the sibling to replace
|
||||
@@ -609,7 +609,7 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
utxo_to_spend=tx_with_multi_children["new_utxos"][2],
|
||||
fee_rate=DEFAULT_FEE*50
|
||||
)
|
||||
expected_error_2siblings = f"v3-rule-violation, tx {tx_with_multi_children['txid']} (wtxid={tx_with_multi_children['wtxid']}) would exceed descendant count limit"
|
||||
expected_error_2siblings = f"TRUC-violation, tx {tx_with_multi_children['txid']} (wtxid={tx_with_multi_children['wtxid']}) would exceed descendant count limit"
|
||||
assert_raises_rpc_error(-26, expected_error_2siblings, node.sendrawtransaction, tx_with_sibling3["hex"])
|
||||
|
||||
# However, an RBF (with conflicting inputs) is possible even if the resulting cluster size exceeds 2
|
||||
@@ -627,21 +627,21 @@ class MempoolAcceptV3(BitcoinTestFramework):
|
||||
node = self.nodes[0]
|
||||
self.wallet = MiniWallet(node)
|
||||
self.generate(self.wallet, 120)
|
||||
self.test_v3_max_vsize()
|
||||
self.test_v3_acceptance()
|
||||
self.test_v3_replacement()
|
||||
self.test_v3_bip125()
|
||||
self.test_v3_reorg()
|
||||
self.test_truc_max_vsize()
|
||||
self.test_truc_acceptance()
|
||||
self.test_truc_replacement()
|
||||
self.test_truc_bip125()
|
||||
self.test_truc_reorg()
|
||||
self.test_nondefault_package_limits()
|
||||
self.test_v3_ancestors_package()
|
||||
self.test_v3_ancestors_package_and_mempool()
|
||||
self.test_truc_ancestors_package()
|
||||
self.test_truc_ancestors_package_and_mempool()
|
||||
self.test_sibling_eviction_package()
|
||||
self.test_v3_package_inheritance()
|
||||
self.test_v3_in_testmempoolaccept()
|
||||
self.test_truc_package_inheritance()
|
||||
self.test_truc_in_testmempoolaccept()
|
||||
self.test_reorg_2child_rbf()
|
||||
self.test_v3_sibling_eviction()
|
||||
self.test_truc_sibling_eviction()
|
||||
self.test_reorg_sibling_eviction_1p2c()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
MempoolAcceptV3().main()
|
||||
MempoolTRUC().main()
|
||||
@@ -266,7 +266,7 @@ BASE_SCRIPTS = [
|
||||
'p2p_v2_encrypted.py',
|
||||
'p2p_v2_earlykeyresponse.py',
|
||||
'example_test.py',
|
||||
'mempool_accept_v3.py',
|
||||
'mempool_truc.py',
|
||||
'wallet_txn_doublespend.py --legacy-wallet',
|
||||
'wallet_multisig_descriptor_psbt.py --descriptors',
|
||||
'wallet_txn_doublespend.py --descriptors',
|
||||
|
||||
@@ -114,16 +114,16 @@ class CreateTxWalletTest(BitcoinTestFramework):
|
||||
self.log.info('Check wallet does not create transactions with version=3 yet')
|
||||
wallet_rpc = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
|
||||
|
||||
self.nodes[0].createwallet("v3")
|
||||
wallet_v3 = self.nodes[0].get_wallet_rpc("v3")
|
||||
self.nodes[0].createwallet("version3")
|
||||
wallet_v3 = self.nodes[0].get_wallet_rpc("version3")
|
||||
|
||||
tx_data = wallet_rpc.send(outputs=[{wallet_v3.getnewaddress(): 25}], options={"change_position": 0})
|
||||
wallet_tx_data = wallet_rpc.gettransaction(tx_data["txid"])
|
||||
tx_current_version = tx_from_hex(wallet_tx_data["hex"])
|
||||
|
||||
# While v3 transactions are standard, the CURRENT_VERSION is 2.
|
||||
# While version=3 transactions are standard, the CURRENT_VERSION is 2.
|
||||
# This test can be removed if CURRENT_VERSION is changed, and replaced with tests that the
|
||||
# wallet handles v3 rules properly.
|
||||
# wallet handles TRUC rules properly.
|
||||
assert_equal(tx_current_version.version, 2)
|
||||
wallet_v3.unloadwallet()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user