diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-10-16 13:43:29 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-10-26 16:31:25 +0100 |
commit | fa9b48549ca39b862a10bcfd90e3eac2a0e8ad2e (patch) | |
tree | 500f0a4fa349929d837e56e06538670b46174064 /test/functional | |
parent | fa7fb0e44241982a6e5cd560c06ac0c9d8f47f88 (diff) |
test: Add test for -blockversion
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/mining_basic.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py index 1b2c7644bd..ba467c1517 100755 --- a/test/functional/mining_basic.py +++ b/test/functional/mining_basic.py @@ -13,6 +13,7 @@ from decimal import Decimal from test_framework.blocktools import ( create_coinbase, + NORMAL_GBT_REQUEST_PARAMS, TIME_GENESIS_BLOCK, ) from test_framework.messages import ( @@ -25,9 +26,11 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, assert_raises_rpc_error, - connect_nodes, ) +VERSIONBITS_TOP_BITS = 0x20000000 +VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28 + def assert_template(node, block, expect, rehash=True): if rehash: @@ -55,8 +58,16 @@ class MiningTest(BitcoinTestFramework): assert_equal(mining_info['blocks'], 200) assert_equal(mining_info['currentblocktx'], 0) assert_equal(mining_info['currentblockweight'], 4000) + + self.log.info('test blockversion') + self.restart_node(0, extra_args=['-mocktime={}'.format(t), '-blockversion=1337']) + self.connect_nodes(0, 1) + assert_equal(1337, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version']) + self.restart_node(0, extra_args=['-mocktime={}'.format(t)]) + self.connect_nodes(0, 1) + assert_equal(VERSIONBITS_TOP_BITS + (1 << VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT), self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version']) self.restart_node(0) - connect_nodes(self.nodes[0], 1) + self.connect_nodes(0, 1) def run_test(self): self.mine_chain() @@ -80,7 +91,7 @@ class MiningTest(BitcoinTestFramework): # Mine a block to leave initial block download node.generatetoaddress(1, node.get_deterministic_priv_key().address) - tmpl = node.getblocktemplate({'rules': ['segwit']}) + tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS) self.log.info("getblocktemplate: Test capability advertised") assert 'proposal' in tmpl['capabilities'] assert 'coinbasetxn' not in tmpl |