Skip to content

Commit fa7fb0e

Browse files
author
MarcoFalke
committed
test: Default blockversion to 4 in feature_block
There is one tests that checks version=1 blocks are rejected. For all other tests the version doesn't matter as long as it is large enough.
1 parent fa2b778 commit fa7fb0e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/functional/feature_block.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ def run_test(self):
12511251
blocks = []
12521252
spend = out[32]
12531253
for i in range(89, LARGE_REORG_SIZE + 89):
1254-
b = self.next_block(i, spend, version=4)
1254+
b = self.next_block(i, spend)
12551255
tx = CTransaction()
12561256
script_length = MAX_BLOCK_BASE_SIZE - len(b.serialize()) - 69
12571257
script_output = CScript([b'\x00' * script_length])
@@ -1270,26 +1270,26 @@ def run_test(self):
12701270
self.move_tip(88)
12711271
blocks2 = []
12721272
for i in range(89, LARGE_REORG_SIZE + 89):
1273-
blocks2.append(self.next_block("alt" + str(i), version=4))
1273+
blocks2.append(self.next_block("alt" + str(i)))
12741274
self.send_blocks(blocks2, False, force_send=True)
12751275

12761276
# extend alt chain to trigger re-org
1277-
block = self.next_block("alt" + str(chain1_tip + 1), version=4)
1277+
block = self.next_block("alt" + str(chain1_tip + 1))
12781278
self.send_blocks([block], True, timeout=2440)
12791279

12801280
# ... and re-org back to the first chain
12811281
self.move_tip(chain1_tip)
1282-
block = self.next_block(chain1_tip + 1, version=4)
1282+
block = self.next_block(chain1_tip + 1)
12831283
self.send_blocks([block], False, force_send=True)
1284-
block = self.next_block(chain1_tip + 2, version=4)
1284+
block = self.next_block(chain1_tip + 2)
12851285
self.send_blocks([block], True, timeout=2440)
12861286

12871287
self.log.info("Reject a block with an invalid block header version")
12881288
b_v1 = self.next_block('b_v1', version=1)
12891289
self.send_blocks([b_v1], success=False, force_send=True, reject_reason='bad-version(0x00000001)', reconnect=True)
12901290

12911291
self.move_tip(chain1_tip + 2)
1292-
b_cb34 = self.next_block('b_cb34', version=4)
1292+
b_cb34 = self.next_block('b_cb34')
12931293
b_cb34.vtx[0].vin[0].scriptSig = b_cb34.vtx[0].vin[0].scriptSig[:-1]
12941294
b_cb34.vtx[0].rehash()
12951295
b_cb34.hashMerkleRoot = b_cb34.calc_merkle_root()
@@ -1323,7 +1323,7 @@ def create_and_sign_transaction(self, spend_tx, value, script=CScript([OP_TRUE])
13231323
tx.rehash()
13241324
return tx
13251325

1326-
def next_block(self, number, spend=None, additional_coinbase_value=0, script=CScript([OP_TRUE]), *, version=1):
1326+
def next_block(self, number, spend=None, additional_coinbase_value=0, script=CScript([OP_TRUE]), *, version=4):
13271327
if self.tip is None:
13281328
base_block_hash = self.genesis_hash
13291329
block_time = int(time.time()) + 1

0 commit comments

Comments
 (0)