Skip to content

Commit 539404f

Browse files
committed
[policy] make v3 transactions standard
Note that, as CURRENT_VERSION = 2, the wallet will not make transactions with nVersion=3 yet.
1 parent 052ede7 commit 539404f

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/policy/policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_
131131
// Changing the default transaction version requires a two step process: first
132132
// adapting relay policy by bumping TX_MAX_STANDARD_VERSION, and then later
133133
// allowing the new transaction version in the wallet/RPC.
134-
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{2};
134+
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{3};
135135

136136
/**
137137
* Check for standard transaction types

test/functional/mempool_accept.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def run_test(self):
287287

288288
self.log.info('Some nonstandard transactions')
289289
tx = tx_from_hex(raw_tx_reference)
290-
tx.nVersion = 3 # A version currently non-standard
290+
tx.nVersion = 4 # A version currently non-standard
291291
self.check_mempool_result(
292292
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'version'}],
293293
rawtxs=[tx.serialize().hex()],

test/functional/mempool_accept_v3.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def wrapper(self):
4242
class MempoolAcceptV3(BitcoinTestFramework):
4343
def set_test_params(self):
4444
self.num_nodes = 1
45-
self.extra_args = [["-acceptnonstdtxn=1"]]
45+
self.extra_args = [[]]
4646
self.setup_clean_chain = True
4747

4848
def check_mempool(self, txids):
@@ -51,7 +51,7 @@ def check_mempool(self, txids):
5151
assert_equal(len(txids), len(mempool_contents))
5252
assert all([txid in txids for txid in mempool_contents])
5353

54-
@cleanup(extra_args=["-datacarriersize=20000", "-acceptnonstdtxn=1"])
54+
@cleanup(extra_args=["-datacarriersize=20000"])
5555
def test_v3_max_vsize(self):
5656
node = self.nodes[0]
5757
self.log.info("Test v3-specific maximum transaction vsize")
@@ -65,7 +65,7 @@ def test_v3_max_vsize(self):
6565
tx_v2_heavy = self.wallet.send_self_transfer(from_node=node, target_weight=(V3_MAX_VSIZE + 1) * WITNESS_SCALE_FACTOR, version=2)
6666
self.check_mempool([tx_v2_heavy["txid"]])
6767

68-
@cleanup(extra_args=["-datacarriersize=1000", "-acceptnonstdtxn=1"])
68+
@cleanup(extra_args=["-datacarriersize=1000"])
6969
def test_v3_acceptance(self):
7070
node = self.nodes[0]
7171
self.log.info("Test a child of a v3 transaction cannot be more than 1000vB")
@@ -105,7 +105,7 @@ def test_v3_acceptance(self):
105105
self.check_mempool([tx_v3_parent_normal["txid"], tx_v3_child_almost_heavy_rbf["txid"]])
106106
assert_equal(node.getmempoolentry(tx_v3_parent_normal["txid"])["descendantcount"], 2)
107107

108-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
108+
@cleanup(extra_args=None)
109109
def test_v3_replacement(self):
110110
node = self.nodes[0]
111111
self.log.info("Test v3 transactions may be replaced by v3 transactions")
@@ -162,7 +162,7 @@ def test_v3_replacement(self):
162162
self.check_mempool([tx_v3_bip125_rbf_v2["txid"], tx_v3_parent["txid"], tx_v3_child["txid"]])
163163

164164

165-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
165+
@cleanup(extra_args=None)
166166
def test_v3_bip125(self):
167167
node = self.nodes[0]
168168
self.log.info("Test v3 transactions that don't signal BIP125 are replaceable")
@@ -186,7 +186,7 @@ def test_v3_bip125(self):
186186
)
187187
self.check_mempool([tx_v3_no_bip125_rbf["txid"]])
188188

189-
@cleanup(extra_args=["-datacarriersize=40000", "-acceptnonstdtxn=1"])
189+
@cleanup(extra_args=["-datacarriersize=40000"])
190190
def test_v3_reorg(self):
191191
node = self.nodes[0]
192192
self.log.info("Test that, during a reorg, v3 rules are not enforced")
@@ -208,7 +208,7 @@ def test_v3_reorg(self):
208208
node.reconsiderblock(block[0])
209209

210210

211-
@cleanup(extra_args=["-limitdescendantsize=10", "-datacarriersize=40000", "-acceptnonstdtxn=1"])
211+
@cleanup(extra_args=["-limitdescendantsize=10", "-datacarriersize=40000"])
212212
def test_nondefault_package_limits(self):
213213
"""
214214
Max standard tx size + v3 rules imply the ancestor/descendant rules (at their default
@@ -241,7 +241,7 @@ def test_nondefault_package_limits(self):
241241
self.generate(node, 1)
242242

243243
self.log.info("Test that a decreased limitancestorsize also applies to v3 parent")
244-
self.restart_node(0, extra_args=["-limitancestorsize=10", "-datacarriersize=40000", "-acceptnonstdtxn=1"])
244+
self.restart_node(0, extra_args=["-limitancestorsize=10", "-datacarriersize=40000"])
245245
tx_v3_parent_large2 = self.wallet.send_self_transfer(
246246
from_node=node,
247247
target_weight=parent_target_weight,
@@ -261,7 +261,7 @@ def test_nondefault_package_limits(self):
261261
assert_raises_rpc_error(-26, f"too-long-mempool-chain, exceeds ancestor size limit", node.sendrawtransaction, tx_v3_child_large2["hex"])
262262
self.check_mempool([tx_v3_parent_large2["txid"]])
263263

264-
@cleanup(extra_args=["-datacarriersize=1000", "-acceptnonstdtxn=1"])
264+
@cleanup(extra_args=["-datacarriersize=1000"])
265265
def test_v3_ancestors_package(self):
266266
self.log.info("Test that v3 ancestor limits are checked within the package")
267267
node = self.nodes[0]
@@ -304,7 +304,7 @@ def test_v3_ancestors_package(self):
304304
result = node.testmempoolaccept([tx_v3_parent["hex"], tx_v3_child["hex"], tx_v3_grandchild["hex"]])
305305
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])
306306

307-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
307+
@cleanup(extra_args=None)
308308
def test_v3_ancestors_package_and_mempool(self):
309309
"""
310310
A v3 transaction in a package cannot have 2 v3 parents.
@@ -334,7 +334,7 @@ def test_v3_ancestors_package_and_mempool(self):
334334
assert_equal(result['package_msg'], f"v3-violation, tx {tx_child_violator['txid']} (wtxid={tx_child_violator['wtxid']}) would have too many ancestors")
335335
self.check_mempool([tx_in_mempool["txid"]])
336336

337-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
337+
@cleanup(extra_args=None)
338338
def test_sibling_eviction_package(self):
339339
"""
340340
When a transaction has a mempool sibling, it may be eligible for sibling eviction.
@@ -410,7 +410,7 @@ def test_sibling_eviction_package(self):
410410
assert_equal(result_package_cpfp["tx-results"][tx_sibling_3['wtxid']]['error'], expected_error_cpfp)
411411

412412

413-
@cleanup(extra_args=["-datacarriersize=1000", "-acceptnonstdtxn=1"])
413+
@cleanup(extra_args=["-datacarriersize=1000"])
414414
def test_v3_package_inheritance(self):
415415
self.log.info("Test that v3 inheritance is checked within package")
416416
node = self.nodes[0]
@@ -429,7 +429,7 @@ def test_v3_package_inheritance(self):
429429
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']})")
430430
self.check_mempool([])
431431

432-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
432+
@cleanup(extra_args=None)
433433
def test_v3_in_testmempoolaccept(self):
434434
node = self.nodes[0]
435435

@@ -479,7 +479,7 @@ def test_v3_in_testmempoolaccept(self):
479479
test_accept_2children_with_in_mempool_parent = node.testmempoolaccept([tx_v3_child_1["hex"], tx_v3_child_2["hex"]])
480480
assert all([result["package-error"] == expected_error_extra for result in test_accept_2children_with_in_mempool_parent])
481481

482-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
482+
@cleanup(extra_args=None)
483483
def test_reorg_2child_rbf(self):
484484
node = self.nodes[0]
485485
self.log.info("Test that children of a v3 transaction can be replaced individually, even if there are multiple due to reorg")
@@ -510,7 +510,7 @@ def test_reorg_2child_rbf(self):
510510
self.check_mempool([ancestor_tx["txid"], child_1_conflict["txid"], child_2["txid"]])
511511
assert_equal(node.getmempoolentry(ancestor_tx["txid"])["descendantcount"], 3)
512512

513-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
513+
@cleanup(extra_args=None)
514514
def test_v3_sibling_eviction(self):
515515
self.log.info("Test sibling eviction for v3")
516516
node = self.nodes[0]
@@ -583,7 +583,7 @@ def test_v3_sibling_eviction(self):
583583
node.sendrawtransaction(tx_v3_child_3["hex"])
584584
self.check_mempool(txids_v2_100 + [tx_v3_parent["txid"], tx_v3_child_3["txid"]])
585585

586-
@cleanup(extra_args=["-acceptnonstdtxn=1"])
586+
@cleanup(extra_args=None)
587587
def test_reorg_sibling_eviction_1p2c(self):
588588
node = self.nodes[0]
589589
self.log.info("Test that sibling eviction is not allowed when multiple siblings exist")

0 commit comments

Comments
 (0)