v30.3-roots.1 · Commit 8: [PATCH 08/68] ci: restore Roots assurance on Core 30.3 interfaces
test/functional/p2p_segwit.py
Before: test/functional/p2p_segwit.py · After: test/functional/p2p_segwit.py
File metadata
index 8a61eaf3be14b89950576ba990d00cfc67472d69..eee34a5fe11f391a78b9ceb84215f156b55c08df 100755
Download original patch · Release notes
Diff rows 1–84 of 84. 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/p2p_segwit.py
CHANGED
|
@@ -215,11 +215,24 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
215
215
|
self.noban_tx_relay = True
|
|
216
216
|
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
|
|
217
217
|
self.extra_args = [
|
|
218
|
+
# Keep Roots' independent data-carrier and script-size policies from masking the
|
|
219
|
+
# SegWit standardness limits exercised by this test.
|
|
218
220
|
# -par=1 should not affect validation outcome or logging/reported failures. It is kept
|
|
219
221
|
# here to exercise the code path still (as it is distinct for multithread script
|
|
220
222
|
# validation).
|
|
221
|
-
["-acceptnonstdtxn=1", f"-testactivationheight=segwit@{SEGWIT_HEIGHT}", "-par=1"],
|
|
222
|
-
["-acceptnonstdtxn=0", f"-testactivationheight=segwit@{SEGWIT_HEIGHT}"],
|
|
223
|
+
[
|
|
224
|
+
"-acceptnonstdtxn=1",
|
|
225
|
+
"-acceptnonstddatacarrier=1",
|
|
226
|
+
f"-testactivationheight=segwit@{SEGWIT_HEIGHT}",
|
|
227
|
+
"-maxscriptsize=100000",
|
|
228
|
+
"-par=1",
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
"-acceptnonstdtxn=0",
|
|
232
|
+
"-acceptnonstddatacarrier=1",
|
|
233
|
+
f"-testactivationheight=segwit@{SEGWIT_HEIGHT}",
|
|
234
|
+
"-maxscriptsize=100000",
|
|
235
|
+
],
|
|
223
236
|
]
|
|
224
237
|
|
|
225
238
|
# Helper functions
|
|
@@ -1357,7 +1370,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1357
1370
|
# First we test this transaction against std_node
|
|
1358
1371
|
# making sure the txid is added to the reject filter
|
|
1359
1372
|
self.std_node.announce_tx_and_wait_for_getdata(tx3)
|
|
1360
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-nonstandard-inputs")
|
|
1373
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-input-witness-unknown")
|
|
1361
1374
|
# Now the node will no longer ask for getdata of this transaction when advertised by same txid
|
|
1362
1375
|
self.std_node.announce_tx_and_wait_for_getdata(tx3, success=False)
|
|
1363
1376
|
|
|
@@ -1712,7 +1725,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1712
1725
|
tx2.wit.vtxinwit[0].scriptWitness.stack = [b'a' * 400]
|
|
1713
1726
|
# This will be rejected due to a policy check:
|
|
1714
1727
|
# No witness is allowed, since it is not a witness program but a p2sh program
|
|
1715
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, True, False, 'bad-witness-nonstandard')
|
|
1728
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, True, False, 'bad-witness-nonwitness-input')
|
|
1716
1729
|
|
|
1717
1730
|
# If we send without witness, it should be accepted.
|
|
1718
1731
|
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, False, True)
|
|
@@ -1777,13 +1790,13 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1777
1790
|
# Testing native P2WSH
|
|
1778
1791
|
# Witness stack size, excluding witnessScript, over 100 is non-standard
|
|
1779
1792
|
p2wsh_txs[0].wit.vtxinwit[0].scriptWitness.stack = [pad] * 101 + [scripts[0]]
|
|
1780
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[0], True, False, 'bad-witness-nonstandard')
|
|
1793
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[0], True, False, 'bad-witness-stackitem-count')
|
|
1781
1794
|
# Non-standard nodes should accept
|
|
1782
1795
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[0], True, True)
|
|
1783
1796
|
|
|
1784
1797
|
# Stack element size over 80 bytes is non-standard
|
|
1785
1798
|
p2wsh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 81] * 100 + [scripts[1]]
|
|
1786
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[1], True, False, 'bad-witness-nonstandard')
|
|
1799
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[1], True, False, 'bad-witness-stackitem-size')
|
|
1787
1800
|
# Non-standard nodes should accept
|
|
1788
1801
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[1], True, True)
|
|
1789
1802
|
# Standard nodes should accept if element size is not over 80 bytes
|
|
@@ -1797,16 +1810,16 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1797
1810
|
|
|
1798
1811
|
# witnessScript size at 3601 bytes is non-standard
|
|
1799
1812
|
p2wsh_txs[3].wit.vtxinwit[0].scriptWitness.stack = [pad, pad, pad, scripts[3]]
|
|
1800
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[3], True, False, 'bad-witness-nonstandard')
|
|
1813
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[3], True, False, 'bad-witness-script-size')
|
|
1801
1814
|
# Non-standard nodes should accept
|
|
1802
1815
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[3], True, True)
|
|
1803
1816
|
|
|
1804
1817
|
# Repeating the same tests with P2SH-P2WSH
|
|
1805
1818
|
p2sh_txs[0].wit.vtxinwit[0].scriptWitness.stack = [pad] * 101 + [scripts[0]]
|
|
1806
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[0], True, False, 'bad-witness-nonstandard')
|
|
1819
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[0], True, False, 'bad-witness-stackitem-count')
|
|
1807
1820
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[0], True, True)
|
|
1808
1821
|
p2sh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 81] * 100 + [scripts[1]]
|
|
1809
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, False, 'bad-witness-nonstandard')
|
|
1822
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, False, 'bad-witness-stackitem-size')
|
|
1810
1823
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[1], True, True)
|
|
1811
1824
|
p2sh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 80] * 100 + [scripts[1]]
|
|
1812
1825
|
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, True)
|
|
@@ -1814,7 +1827,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1814
1827
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[2], True, True)
|
|
1815
1828
|
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[2], True, True)
|
|
1816
1829
|
p2sh_txs[3].wit.vtxinwit[0].scriptWitness.stack = [pad, pad, pad, scripts[3]]
|
|
1817
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[3], True, False, 'bad-witness-nonstandard')
|
|
1830
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[3], True, False, 'bad-witness-script-size')
|
|
1818
1831
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[3], True, True)
|
|
1819
1832
|
|
|
1820
1833
|
self.generate(self.nodes[0], 1) # Mine and clean up the mempool of non-standard node
|