@@ -609,32 +609,32 @@ def run_test(self):
609609 # The next few blocks are going to be created "by hand" since they'll do funky things, such as having
610610 # the first transaction be non-coinbase, etc. The purpose of b44 is to make sure this works.
611611 self .log .info ("Build block 44 manually" )
612- height = self .block_heights [self .tip .sha256 ] + 1
612+ height = self .block_heights [self .tip .hash_int ] + 1
613613 coinbase = create_coinbase (height , self .coinbase_pubkey )
614614 b44 = CBlock ()
615615 b44 .nTime = self .tip .nTime + 1
616- b44 .hashPrevBlock = self .tip .sha256
616+ b44 .hashPrevBlock = self .tip .hash_int
617617 b44 .nBits = REGTEST_N_BITS
618618 b44 .vtx .append (coinbase )
619619 tx = self .create_and_sign_transaction (out [14 ], 1 )
620620 b44 .vtx .append (tx )
621621 b44 .hashMerkleRoot = b44 .calc_merkle_root ()
622622 b44 .solve ()
623623 self .tip = b44
624- self .block_heights [b44 .sha256 ] = height
624+ self .block_heights [b44 .hash_int ] = height
625625 self .blocks [44 ] = b44
626626 self .send_blocks ([b44 ], True )
627627
628628 self .log .info ("Reject a block with a non-coinbase as the first tx" )
629629 non_coinbase = self .create_tx (out [15 ], 0 , 1 )
630630 b45 = CBlock ()
631631 b45 .nTime = self .tip .nTime + 1
632- b45 .hashPrevBlock = self .tip .sha256
632+ b45 .hashPrevBlock = self .tip .hash_int
633633 b45 .nBits = REGTEST_N_BITS
634634 b45 .vtx .append (non_coinbase )
635635 b45 .hashMerkleRoot = b45 .calc_merkle_root ()
636636 b45 .solve ()
637- self .block_heights [b45 .sha256 ] = self .block_heights [self .tip .sha256 ] + 1
637+ self .block_heights [b45 .hash_int ] = self .block_heights [self .tip .hash_int ] + 1
638638 self .tip = b45
639639 self .blocks [45 ] = b45
640640 self .send_blocks ([b45 ], success = False , reject_reason = 'bad-cb-missing' , reconnect = True )
@@ -643,12 +643,12 @@ def run_test(self):
643643 self .move_tip (44 )
644644 b46 = CBlock ()
645645 b46 .nTime = b44 .nTime + 1
646- b46 .hashPrevBlock = b44 .sha256
646+ b46 .hashPrevBlock = b44 .hash_int
647647 b46 .nBits = REGTEST_N_BITS
648648 b46 .vtx = []
649649 b46 .hashMerkleRoot = 0
650650 b46 .solve ()
651- self .block_heights [b46 .sha256 ] = self .block_heights [b44 .sha256 ] + 1
651+ self .block_heights [b46 .hash_int ] = self .block_heights [b44 .hash_int ] + 1
652652 self .tip = b46
653653 assert 46 not in self .blocks
654654 self .blocks [46 ] = b46
@@ -658,7 +658,7 @@ def run_test(self):
658658 self .move_tip (44 )
659659 b47 = self .next_block (47 )
660660 target = uint256_from_compact (b47 .nBits )
661- while b47 .sha256 <= target :
661+ while b47 .hash_int <= target :
662662 # Rehash nonces until an invalid too-high-hash block is found.
663663 b47 .nNonce += 1
664664 self .send_blocks ([b47 ], False , force_send = True , reject_reason = 'high-hash' , reconnect = True )
@@ -731,7 +731,7 @@ def run_test(self):
731731 self .log .info ("Accept a previously rejected future block at a later time" )
732732 node .setmocktime (int (time .time ()) + 2 * 60 * 60 )
733733 self .move_tip (48 )
734- self .block_heights [b48 .sha256 ] = self .block_heights [b44 .sha256 ] + 1 # b48 is a parent of b44
734+ self .block_heights [b48 .hash_int ] = self .block_heights [b44 .hash_int ] + 1 # b48 is a parent of b44
735735 b48p = self .next_block ("48p" )
736736 self .send_blocks ([b48 , b48p ], success = True ) # Reorg to the longer chain
737737 node .invalidateblock (b48p .hash ) # mark b48p as invalid
@@ -1058,12 +1058,12 @@ def run_test(self):
10581058 b72 = self .update_block (72 , [tx1 , tx2 ]) # now tip is 72
10591059 b71 = copy .deepcopy (b72 )
10601060 b71 .vtx .append (tx2 ) # add duplicate tx2
1061- self .block_heights [b71 .sha256 ] = self .block_heights [b69 .sha256 ] + 1 # b71 builds off b69
1061+ self .block_heights [b71 .hash_int ] = self .block_heights [b69 .hash_int ] + 1 # b71 builds off b69
10621062 self .blocks [71 ] = b71
10631063
10641064 assert_equal (len (b71 .vtx ), 4 )
10651065 assert_equal (len (b72 .vtx ), 3 )
1066- assert_equal (b72 .sha256 , b71 .sha256 )
1066+ assert_equal (b72 .hash_int , b71 .hash_int )
10671067
10681068 self .move_tip (71 )
10691069 self .send_blocks ([b71 ], success = False , reject_reason = 'bad-txns-duplicate' , reconnect = True )
@@ -1368,7 +1368,7 @@ def next_block(self, number, spend=None, additional_coinbase_value=0, *, script=
13681368 base_block_hash = self .genesis_hash
13691369 block_time = int (time .time ()) + 1
13701370 else :
1371- base_block_hash = self .tip .sha256
1371+ base_block_hash = self .tip .hash_int
13721372 block_time = self .tip .nTime + 1
13731373 # First create the coinbase
13741374 height = self .block_heights [base_block_hash ] + 1
@@ -1386,7 +1386,7 @@ def next_block(self, number, spend=None, additional_coinbase_value=0, *, script=
13861386 # Block is created. Find a valid nonce.
13871387 block .solve ()
13881388 self .tip = block
1389- self .block_heights [block .sha256 ] = height
1389+ self .block_heights [block .hash_int ] = height
13901390 assert number not in self .blocks
13911391 self .blocks [number ] = block
13921392 return block
@@ -1409,16 +1409,16 @@ def move_tip(self, number):
14091409 def update_block (self , block_number , new_transactions , * , nTime = None ):
14101410 block = self .blocks [block_number ]
14111411 self .add_transactions_to_block (block , new_transactions )
1412- old_sha256 = block .sha256
1412+ old_hash_int = block .hash_int
14131413 if nTime is not None :
14141414 block .nTime = nTime
14151415 block .hashMerkleRoot = block .calc_merkle_root ()
14161416 block .solve ()
14171417 # Update the internal state just like in next_block
14181418 self .tip = block
1419- if block .sha256 != old_sha256 :
1420- self .block_heights [block .sha256 ] = self .block_heights [old_sha256 ]
1421- del self .block_heights [old_sha256 ]
1419+ if block .hash_int != old_hash_int :
1420+ self .block_heights [block .hash_int ] = self .block_heights [old_hash_int ]
1421+ del self .block_heights [old_hash_int ]
14221422 self .blocks [block_number ] = block
14231423 return block
14241424
0 commit comments