Skip to content

Commit 067a835

Browse files
committed
Merge bitcoin/bitcoin#27553: test: Simplify feature_fastprune.py
fa17767 test: Simplify feature_fastprune.py (MarcoFalke) Pull request description: The goal of the test is a single regression check to see if a RPC times out. It shouldn't do more than calling the RPC (and the minimum work needed to get there). Fix that by removing all blocktools imports and a `for` loop. ACKs for top commit: pinheadmz: ACK fa17767 theStack: ACK fa17767 Tree-SHA512: c9c0154102199b250015ece53005a14d52d857dfa986f3b02a2cb899f16ac8e040d24eb826f35ba15e5ee22ee6a59bf8f74bb8d576b9a12ac6e888beeaaf81cc
2 parents da9f62f + fa17767 commit 067a835

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

test/functional/feature_fastprune.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
from test_framework.util import (
88
assert_equal
99
)
10-
from test_framework.blocktools import (
11-
create_block,
12-
create_coinbase,
13-
add_witness_commitment
14-
)
1510
from test_framework.wallet import MiniWallet
1611

1712

@@ -24,18 +19,10 @@ def run_test(self):
2419
self.log.info("ensure that large blocks don't crash or freeze in -fastprune")
2520
wallet = MiniWallet(self.nodes[0])
2621
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))
31-
tip = int(self.nodes[0].getbestblockhash(), 16)
32-
time = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['time'] + 1
33-
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.solve()
37-
self.nodes[0].submitblock(block.serialize().hex())
38-
assert_equal(int(self.nodes[0].getbestblockhash(), 16), block.sha256)
22+
annex = b"\x50" + b"\xff" * 0x10000
23+
tx.wit.vtxinwit[0].scriptWitness.stack.append(annex)
24+
self.generateblock(self.nodes[0], output="raw(55)", transactions=[tx.serialize().hex()])
25+
assert_equal(self.nodes[0].getblockcount(), 201)
3926

4027

4128
if __name__ == '__main__':

0 commit comments

Comments
 (0)