Skip to content

Commit 01fd213

Browse files
committed
Test: Introduce test to check genesis block hashes
1 parent ae35360 commit 01fd213

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
class GenesisHashTest(BitcoinTestFramework):
14+
15+
def add_options(self, parser):
16+
parser.add_argument('--config_path', dest='config_path', default='',
17+
help='Path to write down the generated config for signet into files.')
18+
19+
def set_test_params(self):
20+
self.chain = 'signet'
21+
self.setup_clean_chain = True
22+
self.num_nodes = 2
23+
self.extra_args = [
24+
[
25+
'-con_genesis_style=default_style',
26+
],
27+
[
28+
'-con_genesis_style=regtest2_style',
29+
],
30+
]
31+
32+
def setup_network(self):
33+
self.add_nodes(self.num_nodes, self.extra_args)
34+
35+
def run_test(self):
36+
37+
self.log.info('Check genesis style default_style...')
38+
self.start_node(0)
39+
assert_equal(self.nodes[0].getblockhash(0), 'c03f16ae9e2980de2b61fd6dc84af8ac4a37bea928af632166a6b36c5c871ddd')
40+
41+
self.log.info('Check genesis style regtest2_style...')
42+
self.start_node(1)
43+
assert_equal(self.nodes[1].getblockhash(0), '82ba4b06cffb29f7c5426aa519ecb8e9a2b28b1df11a65c155b5054cca67583d')
44+
45+
if __name__ == '__main__':
46+
GenesisHashTest().main()

test/functional/test_runner.py

Lines changed: 1 addition & 0 deletions
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)