@@ -351,32 +351,32 @@ def update_block(block_number, new_transactions):
351
351
block (22 , spend = out [5 ])
352
352
yield rejected ()
353
353
354
- # Create a block on either side of MAX_BLOCK_SIZE and make sure its accepted/rejected
354
+ # Create a block on either side of MAX_BLOCK_BASE_SIZE and make sure its accepted/rejected
355
355
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
356
356
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b23 (6)
357
357
# \-> b24 (6) -> b25 (7)
358
358
# \-> b3 (1) -> b4 (2)
359
359
tip (15 )
360
360
b23 = block (23 , spend = out [6 ])
361
361
tx = CTransaction ()
362
- script_length = MAX_BLOCK_SIZE - len (b23 .serialize ()) - 69
362
+ script_length = MAX_BLOCK_BASE_SIZE - len (b23 .serialize ()) - 69
363
363
script_output = CScript ([b'\x00 ' * script_length ])
364
364
tx .vout .append (CTxOut (0 , script_output ))
365
365
tx .vin .append (CTxIn (COutPoint (b23 .vtx [1 ].sha256 , 0 )))
366
366
b23 = update_block (23 , [tx ])
367
367
# Make sure the math above worked out to produce a max-sized block
368
- assert_equal (len (b23 .serialize ()), MAX_BLOCK_SIZE )
368
+ assert_equal (len (b23 .serialize ()), MAX_BLOCK_BASE_SIZE )
369
369
yield accepted ()
370
370
save_spendable_output ()
371
371
372
372
# Make the next block one byte bigger and check that it fails
373
373
tip (15 )
374
374
b24 = block (24 , spend = out [6 ])
375
- script_length = MAX_BLOCK_SIZE - len (b24 .serialize ()) - 69
375
+ script_length = MAX_BLOCK_BASE_SIZE - len (b24 .serialize ()) - 69
376
376
script_output = CScript ([b'\x00 ' * (script_length + 1 )])
377
377
tx .vout = [CTxOut (0 , script_output )]
378
378
b24 = update_block (24 , [tx ])
379
- assert_equal (len (b24 .serialize ()), MAX_BLOCK_SIZE + 1 )
379
+ assert_equal (len (b24 .serialize ()), MAX_BLOCK_BASE_SIZE + 1 )
380
380
yield rejected (RejectResult (16 , b'bad-blk-length' ))
381
381
382
382
block (25 , spend = out [7 ])
@@ -523,12 +523,12 @@ def update_block(block_number, new_transactions):
523
523
tx_new = None
524
524
tx_last = tx
525
525
total_size = len (b39 .serialize ())
526
- while (total_size < MAX_BLOCK_SIZE ):
526
+ while (total_size < MAX_BLOCK_BASE_SIZE ):
527
527
tx_new = create_tx (tx_last , 1 , 1 , p2sh_script )
528
528
tx_new .vout .append (CTxOut (tx_last .vout [1 ].nValue - 1 , CScript ([OP_TRUE ])))
529
529
tx_new .rehash ()
530
530
total_size += len (tx_new .serialize ())
531
- if total_size >= MAX_BLOCK_SIZE :
531
+ if total_size >= MAX_BLOCK_BASE_SIZE :
532
532
break
533
533
b39 .vtx .append (tx_new ) # add tx to block
534
534
tx_last = tx_new
@@ -877,7 +877,7 @@ def update_block(block_number, new_transactions):
877
877
878
878
879
879
# This checks that a block with a bloated VARINT between the block_header and the array of tx such that
880
- # the block is > MAX_BLOCK_SIZE with the bloated varint, but <= MAX_BLOCK_SIZE without the bloated varint,
880
+ # the block is > MAX_BLOCK_BASE_SIZE with the bloated varint, but <= MAX_BLOCK_BASE_SIZE without the bloated varint,
881
881
# does not cause a subsequent, identical block with canonical encoding to be rejected. The test does not
882
882
# care whether the bloated block is accepted or rejected; it only cares that the second block is accepted.
883
883
#
@@ -901,12 +901,12 @@ def update_block(block_number, new_transactions):
901
901
tx = CTransaction ()
902
902
903
903
# use canonical serialization to calculate size
904
- script_length = MAX_BLOCK_SIZE - len (b64a .normal_serialize ()) - 69
904
+ script_length = MAX_BLOCK_BASE_SIZE - len (b64a .normal_serialize ()) - 69
905
905
script_output = CScript ([b'\x00 ' * script_length ])
906
906
tx .vout .append (CTxOut (0 , script_output ))
907
907
tx .vin .append (CTxIn (COutPoint (b64a .vtx [1 ].sha256 , 0 )))
908
908
b64a = update_block ("64a" , [tx ])
909
- assert_equal (len (b64a .serialize ()), MAX_BLOCK_SIZE + 8 )
909
+ assert_equal (len (b64a .serialize ()), MAX_BLOCK_BASE_SIZE + 8 )
910
910
yield TestInstance ([[self .tip , None ]])
911
911
912
912
# comptool workaround: to make sure b64 is delivered, manually erase b64a from blockstore
@@ -916,7 +916,7 @@ def update_block(block_number, new_transactions):
916
916
b64 = CBlock (b64a )
917
917
b64 .vtx = copy .deepcopy (b64a .vtx )
918
918
assert_equal (b64 .hash , b64a .hash )
919
- assert_equal (len (b64 .serialize ()), MAX_BLOCK_SIZE )
919
+ assert_equal (len (b64 .serialize ()), MAX_BLOCK_BASE_SIZE )
920
920
self .blocks [64 ] = b64
921
921
update_block (64 , [])
922
922
yield accepted ()
@@ -1250,12 +1250,12 @@ def update_block(block_number, new_transactions):
1250
1250
for i in range (89 , LARGE_REORG_SIZE + 89 ):
1251
1251
b = block (i , spend )
1252
1252
tx = CTransaction ()
1253
- script_length = MAX_BLOCK_SIZE - len (b .serialize ()) - 69
1253
+ script_length = MAX_BLOCK_BASE_SIZE - len (b .serialize ()) - 69
1254
1254
script_output = CScript ([b'\x00 ' * script_length ])
1255
1255
tx .vout .append (CTxOut (0 , script_output ))
1256
1256
tx .vin .append (CTxIn (COutPoint (b .vtx [1 ].sha256 , 0 )))
1257
1257
b = update_block (i , [tx ])
1258
- assert_equal (len (b .serialize ()), MAX_BLOCK_SIZE )
1258
+ assert_equal (len (b .serialize ()), MAX_BLOCK_BASE_SIZE )
1259
1259
test1 .blocks_and_transactions .append ([self .tip , True ])
1260
1260
save_spendable_output ()
1261
1261
spend = get_spendable_output ()
0 commit comments