13
13
14
14
from test_framework .blocktools import (
15
15
create_coinbase ,
16
+ NORMAL_GBT_REQUEST_PARAMS ,
16
17
TIME_GENESIS_BLOCK ,
17
18
)
18
19
from test_framework .messages import (
25
26
from test_framework .util import (
26
27
assert_equal ,
27
28
assert_raises_rpc_error ,
28
- connect_nodes ,
29
29
)
30
30
31
+ VERSIONBITS_TOP_BITS = 0x20000000
32
+ VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28
33
+
31
34
32
35
def assert_template (node , block , expect , rehash = True ):
33
36
if rehash :
@@ -55,8 +58,16 @@ def mine_chain(self):
55
58
assert_equal (mining_info ['blocks' ], 200 )
56
59
assert_equal (mining_info ['currentblocktx' ], 0 )
57
60
assert_equal (mining_info ['currentblockweight' ], 4000 )
61
+
62
+ self .log .info ('test blockversion' )
63
+ self .restart_node (0 , extra_args = ['-mocktime={}' .format (t ), '-blockversion=1337' ])
64
+ self .connect_nodes (0 , 1 )
65
+ assert_equal (1337 , self .nodes [0 ].getblocktemplate (NORMAL_GBT_REQUEST_PARAMS )['version' ])
66
+ self .restart_node (0 , extra_args = ['-mocktime={}' .format (t )])
67
+ self .connect_nodes (0 , 1 )
68
+ assert_equal (VERSIONBITS_TOP_BITS + (1 << VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT ), self .nodes [0 ].getblocktemplate (NORMAL_GBT_REQUEST_PARAMS )['version' ])
58
69
self .restart_node (0 )
59
- connect_nodes ( self .nodes [ 0 ] , 1 )
70
+ self .connect_nodes ( 0 , 1 )
60
71
61
72
def run_test (self ):
62
73
self .mine_chain ()
@@ -80,7 +91,7 @@ def assert_submitblock(block, result_str_1, result_str_2=None):
80
91
81
92
# Mine a block to leave initial block download
82
93
node .generatetoaddress (1 , node .get_deterministic_priv_key ().address )
83
- tmpl = node .getblocktemplate ({ 'rules' : [ 'segwit' ]} )
94
+ tmpl = node .getblocktemplate (NORMAL_GBT_REQUEST_PARAMS )
84
95
self .log .info ("getblocktemplate: Test capability advertised" )
85
96
assert 'proposal' in tmpl ['capabilities' ]
86
97
assert 'coinbasetxn' not in tmpl
0 commit comments