v29.4-roots.2 · Commit 8: [PATCH 08/21] ci: restore assurance and isolate Core fixtures
test/functional/p2p_segwit.py
Before: test/functional/p2p_segwit.py · After: test/functional/p2p_segwit.py
File metadata
index 7815d6ea84ecf8b44bcbacf6bde598a7f839bc52..33220956213a2bfd31e8ee76627ea36f492f286c 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
|
@@ -214,11 +214,24 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
214
214
|
self.noban_tx_relay = True
|
|
215
215
|
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
|
|
216
216
|
self.extra_args = [
|
|
217
|
+
# Keep Roots' independent data-carrier and script-size policies from masking the
|
|
218
|
+
# SegWit standardness limits exercised by this test.
|
|
217
219
|
# -par=1 should not affect validation outcome or logging/reported failures. It is kept
|
|
218
220
|
# here to exercise the code path still (as it is distinct for multithread script
|
|
219
221
|
# validation).
|
|
220
|
-
["-acceptnonstdtxn=1", f"-testactivationheight=segwit@{SEGWIT_HEIGHT}", "-par=1"],
|
|
221
|
-
["-acceptnonstdtxn=0", f"-testactivationheight=segwit@{SEGWIT_HEIGHT}"],
|
|
222
|
+
[
|
|
223
|
+
"-acceptnonstdtxn=1",
|
|
224
|
+
"-acceptnonstddatacarrier=1",
|
|
225
|
+
f"-testactivationheight=segwit@{SEGWIT_HEIGHT}",
|
|
226
|
+
"-maxscriptsize=100000",
|
|
227
|
+
"-par=1",
|
|
228
|
+
],
|
|
229
|
+
[
|
|
230
|
+
"-acceptnonstdtxn=0",
|
|
231
|
+
"-acceptnonstddatacarrier=1",
|
|
232
|
+
f"-testactivationheight=segwit@{SEGWIT_HEIGHT}",
|
|
233
|
+
"-maxscriptsize=100000",
|
|
234
|
+
],
|
|
222
235
|
]
|
|
223
236
|
self.supports_cli = False
|
|
224
237
|
|
|
@@ -1398,7 +1411,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1398
1411
|
# First we test this transaction against std_node
|
|
1399
1412
|
# making sure the txid is added to the reject filter
|
|
1400
1413
|
self.std_node.announce_tx_and_wait_for_getdata(tx3)
|
|
1401
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-nonstandard-inputs")
|
|
1414
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-input-witness-unknown")
|
|
1402
1415
|
# Now the node will no longer ask for getdata of this transaction when advertised by same txid
|
|
1403
1416
|
self.std_node.announce_tx_and_wait_for_getdata(tx3, success=False)
|
|
1404
1417
|
|
|
@@ -1761,7 +1774,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1761
1774
|
tx2.rehash()
|
|
1762
1775
|
# This will be rejected due to a policy check:
|
|
1763
1776
|
# No witness is allowed, since it is not a witness program but a p2sh program
|
|
1764
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, True, False, 'bad-witness-nonstandard')
|
|
1777
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, True, False, 'bad-witness-nonwitness-input')
|
|
1765
1778
|
|
|
1766
1779
|
# If we send without witness, it should be accepted.
|
|
1767
1780
|
test_transaction_acceptance(self.nodes[1], self.std_node, tx2, False, True)
|
|
@@ -1830,13 +1843,13 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1830
1843
|
# Testing native P2WSH
|
|
1831
1844
|
# Witness stack size, excluding witnessScript, over 100 is non-standard
|
|
1832
1845
|
p2wsh_txs[0].wit.vtxinwit[0].scriptWitness.stack = [pad] * 101 + [scripts[0]]
|
|
1833
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[0], True, False, 'bad-witness-nonstandard')
|
|
1846
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[0], True, False, 'bad-witness-stackitem-count')
|
|
1834
1847
|
# Non-standard nodes should accept
|
|
1835
1848
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[0], True, True)
|
|
1836
1849
|
|
|
1837
1850
|
# Stack element size over 80 bytes is non-standard
|
|
1838
1851
|
p2wsh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 81] * 100 + [scripts[1]]
|
|
1839
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[1], True, False, 'bad-witness-nonstandard')
|
|
1852
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[1], True, False, 'bad-witness-stackitem-size')
|
|
1840
1853
|
# Non-standard nodes should accept
|
|
1841
1854
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[1], True, True)
|
|
1842
1855
|
# Standard nodes should accept if element size is not over 80 bytes
|
|
@@ -1850,16 +1863,16 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1850
1863
|
|
|
1851
1864
|
# witnessScript size at 3601 bytes is non-standard
|
|
1852
1865
|
p2wsh_txs[3].wit.vtxinwit[0].scriptWitness.stack = [pad, pad, pad, scripts[3]]
|
|
1853
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[3], True, False, 'bad-witness-nonstandard')
|
|
1866
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2wsh_txs[3], True, False, 'bad-witness-script-size')
|
|
1854
1867
|
# Non-standard nodes should accept
|
|
1855
1868
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2wsh_txs[3], True, True)
|
|
1856
1869
|
|
|
1857
1870
|
# Repeating the same tests with P2SH-P2WSH
|
|
1858
1871
|
p2sh_txs[0].wit.vtxinwit[0].scriptWitness.stack = [pad] * 101 + [scripts[0]]
|
|
1859
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[0], True, False, 'bad-witness-nonstandard')
|
|
1872
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[0], True, False, 'bad-witness-stackitem-count')
|
|
1860
1873
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[0], True, True)
|
|
1861
1874
|
p2sh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 81] * 100 + [scripts[1]]
|
|
1862
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, False, 'bad-witness-nonstandard')
|
|
1875
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, False, 'bad-witness-stackitem-size')
|
|
1863
1876
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[1], True, True)
|
|
1864
1877
|
p2sh_txs[1].wit.vtxinwit[0].scriptWitness.stack = [pad * 80] * 100 + [scripts[1]]
|
|
1865
1878
|
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[1], True, True)
|
|
@@ -1867,7 +1880,7 @@ class SegWitTest(BitcoinTestFramework):
|
|
|
1867
1880
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[2], True, True)
|
|
1868
1881
|
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[2], True, True)
|
|
1869
1882
|
p2sh_txs[3].wit.vtxinwit[0].scriptWitness.stack = [pad, pad, pad, scripts[3]]
|
|
1870
|
-
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[3], True, False, 'bad-witness-nonstandard')
|
|
1883
|
+
test_transaction_acceptance(self.nodes[1], self.std_node, p2sh_txs[3], True, False, 'bad-witness-script-size')
|
|
1871
1884
|
test_transaction_acceptance(self.nodes[0], self.test_node, p2sh_txs[3], True, True)
|
|
1872
1885
|
|
|
1873
1886
|
self.generate(self.nodes[0], 1) # Mine and clean up the mempool of non-standard node
|