@@ -111,7 +111,7 @@ def get_virtual_size(witness_block):
111
111
112
112
Virtual size is base + witness/4."""
113
113
base_size = len (witness_block .serialize (with_witness = False ))
114
- total_size = len (witness_block .serialize (with_witness = True ))
114
+ total_size = len (witness_block .serialize ())
115
115
# the "+3" is so we round up
116
116
vsize = int ((3 * base_size + total_size + 3 ) / 4 )
117
117
return vsize
@@ -403,7 +403,7 @@ def test_block_relay(self):
403
403
block_hash = int (block_hash , 16 )
404
404
block = self .test_node .request_block (block_hash , 2 )
405
405
wit_block = self .test_node .request_block (block_hash , 2 | MSG_WITNESS_FLAG )
406
- assert_equal (block .serialize (True ), wit_block .serialize (True ))
406
+ assert_equal (block .serialize (), wit_block .serialize ())
407
407
assert_equal (block .serialize (), hex_str_to_bytes (rpc_block ))
408
408
else :
409
409
# After activation, witness blocks and non-witness blocks should
@@ -419,15 +419,15 @@ def test_block_relay(self):
419
419
rpc_block = self .nodes [0 ].getblock (block .hash , False )
420
420
non_wit_block = self .test_node .request_block (block .sha256 , 2 )
421
421
wit_block = self .test_node .request_block (block .sha256 , 2 | MSG_WITNESS_FLAG )
422
- assert_equal (wit_block .serialize (True ), hex_str_to_bytes (rpc_block ))
422
+ assert_equal (wit_block .serialize (), hex_str_to_bytes (rpc_block ))
423
423
assert_equal (wit_block .serialize (False ), non_wit_block .serialize ())
424
- assert_equal (wit_block .serialize (True ), block .serialize (True ))
424
+ assert_equal (wit_block .serialize (), block .serialize ())
425
425
426
426
# Test size, vsize, weight
427
427
rpc_details = self .nodes [0 ].getblock (block .hash , True )
428
- assert_equal (rpc_details ["size" ], len (block .serialize (True )))
428
+ assert_equal (rpc_details ["size" ], len (block .serialize ()))
429
429
assert_equal (rpc_details ["strippedsize" ], len (block .serialize (False )))
430
- weight = 3 * len (block .serialize (False )) + len (block .serialize (True ))
430
+ weight = 3 * len (block .serialize (False )) + len (block .serialize ())
431
431
assert_equal (rpc_details ["weight" ], weight )
432
432
433
433
# Upgraded node should not ask for blocks from unupgraded
@@ -884,13 +884,13 @@ def test_block_malleability(self):
884
884
885
885
# We can't send over the p2p network, because this is too big to relay
886
886
# TODO: repeat this test with a block that can be relayed
887
- self .nodes [0 ].submitblock (block .serialize (True ).hex ())
887
+ self .nodes [0 ].submitblock (block .serialize ().hex ())
888
888
889
889
assert self .nodes [0 ].getbestblockhash () != block .hash
890
890
891
891
block .vtx [0 ].wit .vtxinwit [0 ].scriptWitness .stack .pop ()
892
892
assert get_virtual_size (block ) < MAX_BLOCK_BASE_SIZE
893
- self .nodes [0 ].submitblock (block .serialize (True ).hex ())
893
+ self .nodes [0 ].submitblock (block .serialize ().hex ())
894
894
895
895
assert self .nodes [0 ].getbestblockhash () == block .hash
896
896
@@ -969,7 +969,7 @@ def test_witness_block_size(self):
969
969
assert_equal (vsize , MAX_BLOCK_BASE_SIZE + 1 )
970
970
# Make sure that our test case would exceed the old max-network-message
971
971
# limit
972
- assert len (block .serialize (True )) > 2 * 1024 * 1024
972
+ assert len (block .serialize ()) > 2 * 1024 * 1024
973
973
974
974
test_witness_block (self .nodes [0 ], self .test_node , block , accepted = False )
975
975
@@ -997,14 +997,14 @@ def test_submit_block(self):
997
997
add_witness_commitment (block , nonce = 1 )
998
998
block .vtx [0 ].wit = CTxWitness () # drop the nonce
999
999
block .solve ()
1000
- self .nodes [0 ].submitblock (block .serialize (True ).hex ())
1000
+ self .nodes [0 ].submitblock (block .serialize ().hex ())
1001
1001
assert self .nodes [0 ].getbestblockhash () != block .hash
1002
1002
1003
1003
# Now redo commitment with the standard nonce, but let bitcoind fill it in.
1004
1004
add_witness_commitment (block , nonce = 0 )
1005
1005
block .vtx [0 ].wit = CTxWitness ()
1006
1006
block .solve ()
1007
- self .nodes [0 ].submitblock (block .serialize (True ).hex ())
1007
+ self .nodes [0 ].submitblock (block .serialize ().hex ())
1008
1008
assert_equal (self .nodes [0 ].getbestblockhash (), block .hash )
1009
1009
1010
1010
# This time, add a tx with non-empty witness, but don't supply
@@ -1019,7 +1019,7 @@ def test_submit_block(self):
1019
1019
block_2 .vtx [0 ].vout .pop ()
1020
1020
block_2 .vtx [0 ].wit = CTxWitness ()
1021
1021
1022
- self .nodes [0 ].submitblock (block_2 .serialize (True ).hex ())
1022
+ self .nodes [0 ].submitblock (block_2 .serialize ().hex ())
1023
1023
# Tip should not advance!
1024
1024
assert self .nodes [0 ].getbestblockhash () != block_2 .hash
1025
1025
0 commit comments