|
| 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 | + { |
| 16 | + 'memo': 'regtest2_style', |
| 17 | + 'genesis': '82ba4b06cffb29f7c5426aa519ecb8e9a2b28b1df11a65c155b5054cca67583d', |
| 18 | + 'args': [ |
| 19 | + '-con_genesis_style=regtest2_style', |
| 20 | + ], |
| 21 | + }, |
| 22 | + |
| 23 | + { |
| 24 | + 'memo': 'default_style', |
| 25 | + 'genesis': 'c03f16ae9e2980de2b61fd6dc84af8ac4a37bea928af632166a6b36c5c871ddd', |
| 26 | + 'args': [ |
| 27 | + '-con_genesis_style=default_style', |
| 28 | + ], |
| 29 | + }, |
| 30 | + |
| 31 | +] |
| 32 | + |
| 33 | +class GenesisHashTest(BitcoinTestFramework): |
| 34 | + |
| 35 | + def set_test_params(self): |
| 36 | + self.chain = 'signet' |
| 37 | + self.setup_clean_chain = True |
| 38 | + self.num_nodes = len(GENESIS_ARGS_MAP) |
| 39 | + self.extra_args = [item['args'] for item in GENESIS_ARGS_MAP] |
| 40 | + |
| 41 | + def setup_network(self): |
| 42 | + # Don't connect the nodes as they use incompatible chains |
| 43 | + self.add_nodes(self.num_nodes, self.extra_args) |
| 44 | + self.start_nodes() |
| 45 | + |
| 46 | + def run_test(self): |
| 47 | + for i in range(len(GENESIS_ARGS_MAP)): |
| 48 | + self.log.info('Check genesis style %s...' % GENESIS_ARGS_MAP[i]['memo']) |
| 49 | + assert_equal(self.nodes[i].getblockhash(0), GENESIS_ARGS_MAP[i]['genesis']) |
| 50 | + |
| 51 | +if __name__ == '__main__': |
| 52 | + GenesisHashTest().main() |
0 commit comments