Skip to content

Commit e75f8a0

Browse files
committed
Test: Introduce test to check genesis block hashes
1 parent cf49637 commit e75f8a0

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2018-2018 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
"""Test genesis block hash
6+
"""
7+
8+
from test_framework.test_framework import BitcoinTestFramework
9+
from test_framework.util import (
10+
assert_equal,
11+
)
12+
13+
GENESIS_ARGS_MAP = [
14+
{
15+
'memo': 'regtest2_style',
16+
'genesis': '82ba4b06cffb29f7c5426aa519ecb8e9a2b28b1df11a65c155b5054cca67583d',
17+
'args': [
18+
'-con_genesis_style=regtest2_style',
19+
],
20+
},
21+
22+
{
23+
'memo': 'default_style',
24+
'genesis': 'c03f16ae9e2980de2b61fd6dc84af8ac4a37bea928af632166a6b36c5c871ddd',
25+
'args': [
26+
'-con_genesis_style=default_style',
27+
],
28+
},
29+
]
30+
31+
class GenesisHashTest(BitcoinTestFramework):
32+
33+
def set_test_params(self):
34+
self.chain = 'signet'
35+
self.setup_clean_chain = True
36+
self.num_nodes = len(GENESIS_ARGS_MAP)
37+
self.extra_args = [item['args'] for item in GENESIS_ARGS_MAP]
38+
39+
def setup_network(self):
40+
# Don't connect the nodes as they use incompatible chains
41+
self.add_nodes(self.num_nodes, self.extra_args)
42+
self.start_nodes()
43+
44+
def run_test(self):
45+
for i in range(len(GENESIS_ARGS_MAP)):
46+
self.log.info('Check genesis style %s...' % GENESIS_ARGS_MAP[i]['memo'])
47+
assert_equal(self.nodes[i].getblockhash(0), GENESIS_ARGS_MAP[i]['genesis'])
48+
49+
if __name__ == '__main__':
50+
GenesisHashTest().main()

test/functional/test_runner.py

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
'rpc_scantxoutset.py',
151151
'feature_logging.py',
152152
'p2p_node_network_limited.py',
153+
'feature_genesishash.py',
153154
'feature_blocksdir.py',
154155
'feature_config_args.py',
155156
'feature_help.py',

0 commit comments

Comments
 (0)