v30.3-roots.1 · Commit 10: [PATCH 10/68] fix: harden Roots priority and wallet policy boundaries
test/functional/mempool_accept.py
Before: test/functional/mempool_accept.py · After: test/functional/mempool_accept.py
File metadata
index 7dbd7ba1e2ede54ae9c7cef2eeb6ed928a0072dc..54bf8fd447ad8b93d227619874a1bbd2e7c6fbf2 100755
Download original patch · Release notes
Diff rows 1–59 of 59. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
test/functional/mempool_accept.py
CHANGED
|
@@ -60,7 +60,8 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
60
60
|
def set_test_params(self):
|
|
61
61
|
self.num_nodes = 1
|
|
62
62
|
self.extra_args = [[
|
|
63
|
-
'-txindex','-permitbaremultisig=0',
|
|
63
|
+
'-txindex', '-permitbaredatacarrier=1', '-permitbaremultisig=0',
|
|
64
|
+
'-datacarriersize=100000', '-maxscriptsize=100000',
|
|
64
65
|
]] * self.num_nodes
|
|
65
66
|
self.supports_cli = False
|
|
66
67
|
|
|
@@ -78,6 +79,18 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
78
79
|
assert_equal(result_expected, result_test)
|
|
79
80
|
assert_equal(self.nodes[0].getmempoolinfo()['size'], self.mempool_size) # Must not change mempool state
|
|
80
81
|
|
|
82
|
+
def check_multi_op_return_result(self, result_expected, **kwargs):
|
|
83
|
+
# Roots deliberately rejects multiple OP_RETURN outputs as standard
|
|
84
|
+
# policy. Preserve Core's acceptance cases with the explicit regtest
|
|
85
|
+
# nonstandard override, and check both observable policy contracts.
|
|
86
|
+
self.check_mempool_result(
|
|
87
|
+
result_expected=[{'txid': result_expected[0]['txid'], 'allowed': False, 'reject-reason': 'multi-op-return'}],
|
|
88
|
+
**kwargs,
|
|
89
|
+
)
|
|
90
|
+
self.restart_node(0, extra_args=self.extra_args[0] + ['-acceptnonstdtxn=1'])
|
|
91
|
+
self.check_mempool_result(result_expected=result_expected, **kwargs)
|
|
92
|
+
self.restart_node(0)
|
|
93
|
+
|
|
81
94
|
def run_test(self):
|
|
82
95
|
node = self.nodes[0]
|
|
83
96
|
self.wallet = MiniWallet(node)
|
|
@@ -335,7 +348,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
335
348
|
tx.vout[0] = output_p2sh_burn
|
|
336
349
|
tx.vout[0].nValue -= 1 # Make output smaller, such that it is dust for our policy
|
|
337
350
|
self.check_mempool_result(
|
|
338
|
-
result_expected=[{'txid': tx.txid_hex, 'allowed': False, 'reject-reason': 'dust'}],
|
|
351
|
+
result_expected=[{'txid': tx.txid_hex, 'allowed': False, 'reject-reason': 'dust-nonanchor'}],
|
|
339
352
|
rawtxs=[tx.serialize().hex()],
|
|
340
353
|
)
|
|
341
354
|
|
|
@@ -353,7 +366,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
353
366
|
tx.vout.append(CTxOut(0, CScript([OP_RETURN, b'\xff'])))
|
|
354
367
|
tx.vout.append(CTxOut(0, CScript([OP_RETURN, b'\xff' * 50000])))
|
|
355
368
|
|
|
356
|
-
self.check_mempool_result(
|
|
369
|
+
self.check_multi_op_return_result(
|
|
357
370
|
result_expected=[{'txid': tx.txid_hex, 'allowed': True, 'vsize': tx.get_vsize(), 'fees': {'base': Decimal('0.05')}}],
|
|
358
371
|
rawtxs=[tx.serialize().hex()],
|
|
359
372
|
maxfeerate=0
|
|
@@ -365,7 +378,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
365
378
|
tx.vout[0].nValue = int(tx.vout[0].nValue / op_return_count)
|
|
366
379
|
tx.vout[0].scriptPubKey = CScript([OP_RETURN, b'\xff'])
|
|
367
380
|
tx.vout = [tx.vout[0]] * op_return_count
|
|
368
|
-
self.check_mempool_result(
|
|
381
|
+
self.check_multi_op_return_result(
|
|
369
382
|
result_expected=[{"txid": tx.txid_hex, "allowed": True, "vsize": tx.get_vsize(), "fees": {"base": Decimal("0.05000026")}}],
|
|
370
383
|
rawtxs=[tx.serialize().hex()],
|
|
371
384
|
)
|
|
@@ -448,7 +461,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
448
461
|
anchor_nonempty_wit_spend.wit.vtxinwit[0].scriptWitness.stack.append(b"f")
|
|
449
462
|
|
|
450
463
|
self.check_mempool_result(
|
|
451
|
-
result_expected=[{'txid': anchor_nonempty_wit_spend.txid_hex, 'allowed': False, 'reject-reason': 'bad-witness-nonstandard'}],
|
|
464
|
+
result_expected=[{'txid': anchor_nonempty_wit_spend.txid_hex, 'allowed': False, 'reject-reason': 'bad-witness-anchor-not-empty'}],
|
|
452
465
|
rawtxs=[anchor_nonempty_wit_spend.serialize().hex()],
|
|
453
466
|
maxfeerate=0,
|
|
454
467
|
)
|