@@ -64,9 +64,23 @@ def set_test_params(self):
64
64
def skip_test_if_missing_module (self ):
65
65
self .skip_if_no_wallet ()
66
66
67
+ def test_cltv_info (self , * , is_active ):
68
+ assert_equal (
69
+ next (s for s in self .nodes [0 ].getblockchaininfo ()['softforks' ] if s ['id' ] == 'bip65' ),
70
+ {
71
+ "id" : "bip65" ,
72
+ "version" : 4 ,
73
+ "reject" : {
74
+ "status" : is_active
75
+ }
76
+ },
77
+ )
78
+
67
79
def run_test (self ):
68
80
self .nodes [0 ].add_p2p_connection (P2PInterface ())
69
81
82
+ self .test_cltv_info (is_active = False )
83
+
70
84
self .log .info ("Mining %d blocks" , CLTV_HEIGHT - 2 )
71
85
self .coinbase_txids = [self .nodes [0 ].getblock (b )['tx' ][0 ] for b in self .nodes [0 ].generate (CLTV_HEIGHT - 2 )]
72
86
self .nodeaddress = self .nodes [0 ].getnewaddress ()
@@ -86,7 +100,9 @@ def run_test(self):
86
100
block .hashMerkleRoot = block .calc_merkle_root ()
87
101
block .solve ()
88
102
103
+ self .test_cltv_info (is_active = False )
89
104
self .nodes [0 ].p2p .send_and_ping (msg_block (block ))
105
+ self .test_cltv_info (is_active = False ) # Not active as of current tip, but next block must obey rules
90
106
assert_equal (self .nodes [0 ].getbestblockhash (), block .hash )
91
107
92
108
self .log .info ("Test that blocks must now be at least version 4" )
@@ -135,7 +151,9 @@ def run_test(self):
135
151
block .hashMerkleRoot = block .calc_merkle_root ()
136
152
block .solve ()
137
153
154
+ self .test_cltv_info (is_active = False ) # Not active as of current tip, but next block must obey rules
138
155
self .nodes [0 ].p2p .send_and_ping (msg_block (block ))
156
+ self .test_cltv_info (is_active = True ) # Active as of current tip
139
157
assert_equal (int (self .nodes [0 ].getbestblockhash (), 16 ), block .sha256 )
140
158
141
159
0 commit comments