Skip to content

Commit f0b677c

Browse files
author
Claude Code
committed
dash: adapt feature_fastprune test for non-segwit
Since Dash doesn't have segwit/witness support, adapt the test to create a large block using many regular transactions instead of using witness data to inflate block size. This maintains the test's purpose of ensuring -fastprune handles blocks larger than 64kb without crashing.
1 parent ba1918b commit f0b677c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/functional/feature_fastprune.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from test_framework.blocktools import (
1111
create_block,
1212
create_coinbase,
13-
add_witness_commitment
1413
)
1514
from test_framework.wallet import MiniWallet
1615

@@ -23,16 +22,18 @@ def set_test_params(self):
2322
def run_test(self):
2423
self.log.info("ensure that large blocks don't crash or freeze in -fastprune")
2524
wallet = MiniWallet(self.nodes[0])
26-
tx = wallet.create_self_transfer()['tx']
27-
annex = [0x50]
28-
for _ in range(0x10000):
29-
annex.append(0xff)
30-
tx.wit.vtxinwit[0].scriptWitness.stack.append(bytes(annex))
25+
26+
# Create many transactions to make a large block (>64kb)
27+
# Since Dash doesn't have witness data, we need to create many regular transactions
28+
txs = []
29+
for _ in range(500): # Create enough transactions to exceed 64kb
30+
tx = wallet.create_self_transfer()['tx']
31+
txs.append(tx)
32+
3133
tip = int(self.nodes[0].getbestblockhash(), 16)
3234
time = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['time'] + 1
3335
height = self.nodes[0].getblockcount() + 1
34-
block = create_block(hashprev=tip, ntime=time, txlist=[tx], coinbase=create_coinbase(height=height))
35-
add_witness_commitment(block)
36+
block = create_block(hashprev=tip, ntime=time, txlist=txs, coinbase=create_coinbase(height=height))
3637
block.solve()
3738
self.nodes[0].submitblock(block.serialize().hex())
3839
assert_equal(int(self.nodes[0].getbestblockhash(), 16), block.sha256)

0 commit comments

Comments
 (0)