8383 assert_raises_rpc_error ,
8484)
8585
86- # The versionbit bit used to signal activation of SegWit
87- VB_WITNESS_BIT = 1
88- VB_TOP_BITS = 0x20000000
89-
9086MAX_SIGOP_COST = 80000
9187
9288SEGWIT_HEIGHT = 120
@@ -206,13 +202,13 @@ def skip_test_if_missing_module(self):
206202
207203 # Helper functions
208204
209- def build_next_block (self , version = 4 ):
205+ def build_next_block (self ):
210206 """Build a block on top of node0's tip."""
211207 tip = self .nodes [0 ].getbestblockhash ()
212208 height = self .nodes [0 ].getblockcount () + 1
213209 block_time = self .nodes [0 ].getblockheader (tip )["mediantime" ] + 1
214210 block = create_block (int (tip , 16 ), create_coinbase (height ), block_time )
215- block .nVersion = version
211+ block .nVersion = 4
216212 block .rehash ()
217213 return block
218214
@@ -298,7 +294,7 @@ def test_non_witness_transaction(self):
298294 # Mine a block with an anyone-can-spend coinbase,
299295 # let it mature, then try to spend it.
300296
301- block = self .build_next_block (version = 1 )
297+ block = self .build_next_block ()
302298 block .solve ()
303299 self .test_node .send_and_ping (msg_no_witness_block (block )) # make sure the block was processed
304300 txid = block .vtx [0 ].sha256
@@ -336,8 +332,8 @@ def test_unnecessary_witness_before_segwit_activation(self):
336332 tx .rehash ()
337333 assert tx .sha256 != tx .calc_sha256 (with_witness = True )
338334
339- # Construct a segwit-signaling block that includes the transaction.
340- block = self .build_next_block (version = ( VB_TOP_BITS | ( 1 << VB_WITNESS_BIT )) )
335+ # Construct a block that includes the transaction.
336+ block = self .build_next_block ()
341337 self .update_witness_block_with_transactions (block , [tx ])
342338 # Sending witness data before activation is not allowed (anti-spam
343339 # rule).
@@ -364,27 +360,21 @@ def test_block_relay(self):
364360 # test_node has set NODE_WITNESS, so all getdata requests should be for
365361 # witness blocks.
366362 # Test announcing a block via inv results in a getdata, and that
367- # announcing a version 4 or random VB block with a header results in a getdata
363+ # announcing a block with a header results in a getdata
368364 block1 = self .build_next_block ()
369365 block1 .solve ()
370366
371367 self .test_node .announce_block_and_wait_for_getdata (block1 , use_header = False )
372368 assert self .test_node .last_message ["getdata" ].inv [0 ].type == blocktype
373369 test_witness_block (self .nodes [0 ], self .test_node , block1 , True )
374370
375- block2 = self .build_next_block (version = 4 )
371+ block2 = self .build_next_block ()
376372 block2 .solve ()
377373
378374 self .test_node .announce_block_and_wait_for_getdata (block2 , use_header = True )
379375 assert self .test_node .last_message ["getdata" ].inv [0 ].type == blocktype
380376 test_witness_block (self .nodes [0 ], self .test_node , block2 , True )
381377
382- block3 = self .build_next_block (version = (VB_TOP_BITS | (1 << 15 )))
383- block3 .solve ()
384- self .test_node .announce_block_and_wait_for_getdata (block3 , use_header = True )
385- assert self .test_node .last_message ["getdata" ].inv [0 ].type == blocktype
386- test_witness_block (self .nodes [0 ], self .test_node , block3 , True )
387-
388378 # Check that we can getdata for witness blocks or regular blocks,
389379 # and the right thing happens.
390380 if not self .segwit_active :
@@ -429,7 +419,7 @@ def test_block_relay(self):
429419 assert_equal (rpc_details ["weight" ], block .get_weight ())
430420
431421 # Upgraded node should not ask for blocks from unupgraded
432- block4 = self .build_next_block (version = 4 )
422+ block4 = self .build_next_block ()
433423 block4 .solve ()
434424 self .old_node .getdataset = set ()
435425
0 commit comments