Skip to content

Commit bfa9309

Browse files
committedMay 31, 2021
Use COINBASE_MATURITY constant in functional tests.
1 parent 525448d commit bfa9309

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+125
-66
lines changed
 

‎test/functional/feature_assumevalid.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"""
3232

3333
from test_framework.blocktools import (
34+
COINBASE_MATURITY,
3435
create_block,
3536
create_coinbase,
3637
)
@@ -161,8 +162,8 @@ def run_test(self):
161162

162163
# Send blocks to node0. Block 102 will be rejected.
163164
self.send_blocks_until_disconnected(p2p0)
164-
self.wait_until(lambda: self.nodes[0].getblockcount() >= 101)
165-
assert_equal(self.nodes[0].getblockcount(), 101)
165+
self.wait_until(lambda: self.nodes[0].getblockcount() >= COINBASE_MATURITY + 1)
166+
assert_equal(self.nodes[0].getblockcount(), COINBASE_MATURITY + 1)
166167

167168
# Send all blocks to node1. All blocks will be accepted.
168169
for i in range(2202):
@@ -173,8 +174,8 @@ def run_test(self):
173174

174175
# Send blocks to node2. Block 102 will be rejected.
175176
self.send_blocks_until_disconnected(p2p2)
176-
self.wait_until(lambda: self.nodes[2].getblockcount() >= 101)
177-
assert_equal(self.nodes[2].getblockcount(), 101)
177+
self.wait_until(lambda: self.nodes[2].getblockcount() >= COINBASE_MATURITY + 1)
178+
assert_equal(self.nodes[2].getblockcount(), COINBASE_MATURITY + 1)
178179

179180

180181
if __name__ == '__main__':

‎test/functional/feature_backwards_compatibility.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import shutil
2424

25+
from test_framework.blocktools import COINBASE_MATURITY
2526
from test_framework.test_framework import BitcoinTestFramework
2627
from test_framework.descriptors import descsum_create
2728

@@ -64,13 +65,13 @@ def setup_nodes(self):
6465
self.import_deterministic_coinbase_privkeys()
6566

6667
def run_test(self):
67-
self.nodes[0].generatetoaddress(101, self.nodes[0].getnewaddress())
68+
self.nodes[0].generatetoaddress(COINBASE_MATURITY + 1, self.nodes[0].getnewaddress())
6869

6970
self.sync_blocks()
7071

7172
# Sanity check the test framework:
7273
res = self.nodes[self.num_nodes - 1].getblockchaininfo()
73-
assert_equal(res['blocks'], 101)
74+
assert_equal(res['blocks'], COINBASE_MATURITY + 1)
7475

7576
node_master = self.nodes[self.num_nodes - 5]
7677
node_v19 = self.nodes[self.num_nodes - 4]

0 commit comments

Comments
 (0)
Please sign in to comment.