@@ -158,7 +158,7 @@ def build_block_on_tip(self, node):
158158    def  make_utxos (self ):
159159        block  =  self .build_block_on_tip (self .nodes [0 ])
160160        self .segwit_node .send_and_ping (msg_no_witness_block (block ))
161-         assert   int (self .nodes [0 ].getbestblockhash (), 16 )  ==   block .hash_int 
161+         assert_equal (self .nodes [0 ].getbestblockhash (), block .hash_hex ) 
162162        self .generate (self .wallet , COINBASE_MATURITY )
163163
164164        total_value  =  block .vtx [0 ].vout [0 ].nValue 
@@ -173,7 +173,7 @@ def make_utxos(self):
173173        block2 .hashMerkleRoot  =  block2 .calc_merkle_root ()
174174        block2 .solve ()
175175        self .segwit_node .send_and_ping (msg_no_witness_block (block2 ))
176-         assert_equal (int ( self .nodes [0 ].getbestblockhash (), 16 ),  block2 .hash_int )
176+         assert_equal (self .nodes [0 ].getbestblockhash (), block2 .hash_hex )
177177        self .utxos .extend ([[tx .txid_int , i , out_value ] for  i  in  range (10 )])
178178
179179
@@ -406,7 +406,7 @@ def test_compactblock_requests(self, test_node):
406406            msg .block_transactions .blockhash  =  block .hash_int 
407407            msg .block_transactions .transactions  =  [block .vtx [0 ]]
408408            test_node .send_and_ping (msg )
409-             assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
409+             assert_equal (node .getbestblockhash (), block .hash_hex )
410410
411411    # Create a chain of transactions from given utxo, and add to a new block. 
412412    def  build_block_with_transactions (self , node , utxo , num_transactions ):
@@ -555,7 +555,7 @@ def test_incorrect_blocktxn_response(self, test_node):
555555
556556        # Deliver the block 
557557        test_node .send_and_ping (msg_block (block ))
558-         assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
558+         assert_equal (node .getbestblockhash (), block .hash_hex )
559559
560560    def  test_getblocktxn_handler (self , test_node ):
561561        node  =  self .nodes [0 ]
@@ -595,7 +595,7 @@ def test_getblocktxn_handler(self, test_node):
595595            test_node .last_message .pop ("blocktxn" , None )
596596        test_node .send_and_ping (msg )
597597        with  p2p_lock :
598-             assert_equal (test_node .last_message ["block" ].block .hash_int ,  int ( block_hash ,  16 ) )
598+             assert_equal (test_node .last_message ["block" ].block .hash_hex ,  block_hash )
599599            assert  "blocktxn"  not  in test_node .last_message 
600600
601601        # Request with out-of-bounds tx index results in disconnect 
@@ -651,7 +651,7 @@ def test_compactblocks_not_at_tip(self, test_node):
651651        test_node .send_without_ping (msg_getdata ([CInv (MSG_CMPCT_BLOCK , int (new_blocks [0 ], 16 ))]))
652652        test_node .wait_until (lambda : "block"  in  test_node .last_message , timeout = 30 )
653653        with  p2p_lock :
654-             assert_equal (test_node .last_message ["block" ].block .hash_int ,  int ( new_blocks [0 ],  16 ) )
654+             assert_equal (test_node .last_message ["block" ].block .hash_hex ,  new_blocks [0 ])
655655
656656        # Generate an old compactblock, and verify that it's not accepted. 
657657        cur_height  =  node .getblockcount ()
@@ -724,7 +724,7 @@ def test_invalid_tx_in_compactblock(self, test_node):
724724        test_node .send_and_ping (msg )
725725
726726        # Check that the tip didn't advance 
727-         assert_not_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
727+         assert_not_equal (node .getbestblockhash (), block .hash_hex )
728728        test_node .sync_with_ping ()
729729
730730    # Helper for enabling cb announcements 
@@ -761,7 +761,7 @@ def announce_cmpct_block(node, peer):
761761            assert  tx .txid_hex  in  mempool 
762762
763763        delivery_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
764-         assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
764+         assert_equal (node .getbestblockhash (), block .hash_hex )
765765
766766        self .utxos .append ([block .vtx [- 1 ].txid_int , 0 , block .vtx [- 1 ].vout [0 ].nValue ])
767767
@@ -777,13 +777,13 @@ def announce_cmpct_block(node, peer):
777777
778778        cmpct_block .use_witness  =  True 
779779        delivery_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
780-         assert_not_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
780+         assert_not_equal (node .getbestblockhash (), block .hash_hex )
781781
782782        msg  =  msg_no_witness_blocktxn ()
783783        msg .block_transactions .blockhash  =  block .hash_int 
784784        msg .block_transactions .transactions  =  block .vtx [1 :]
785785        stalling_peer .send_and_ping (msg )
786-         assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
786+         assert_equal (node .getbestblockhash (), block .hash_hex )
787787
788788    def  test_highbandwidth_mode_states_via_getpeerinfo (self ):
789789        # create new p2p connection for a fresh state w/o any prior sendcmpct messages sent 
@@ -839,7 +839,7 @@ def announce_cmpct_block(node, peer, txn_count):
839839            msg .block_transactions .blockhash  =  block .hash_int 
840840            msg .block_transactions .transactions  =  block .vtx [1 :]
841841            peer .send_and_ping (msg )
842-             assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
842+             assert_equal (node .getbestblockhash (), block .hash_hex )
843843            peer .clear_getblocktxn ()
844844
845845        # Test the simple parallel download case... 
@@ -854,26 +854,26 @@ def announce_cmpct_block(node, peer, txn_count):
854854            with  p2p_lock :
855855                # The second peer to announce should still get a getblocktxn 
856856                assert  "getblocktxn"  in  delivery_peer .last_message 
857-             assert_not_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
857+             assert_not_equal (node .getbestblockhash (), block .hash_hex )
858858
859859            inbound_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
860860            with  p2p_lock :
861861                # The third inbound peer to announce should *not* get a getblocktxn 
862862                assert  "getblocktxn"  not  in inbound_peer .last_message 
863-             assert_not_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
863+             assert_not_equal (node .getbestblockhash (), block .hash_hex )
864864
865865            outbound_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
866866            with  p2p_lock :
867867                # The third peer to announce should get a getblocktxn if outbound 
868868                assert  "getblocktxn"  in  outbound_peer .last_message 
869-             assert_not_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
869+             assert_not_equal (node .getbestblockhash (), block .hash_hex )
870870
871871            # Second peer completes the compact block first 
872872            msg  =  msg_blocktxn ()
873873            msg .block_transactions .blockhash  =  block .hash_int 
874874            msg .block_transactions .transactions  =  block .vtx [1 :]
875875            delivery_peer .send_and_ping (msg )
876-             assert_equal (int ( node .getbestblockhash (), 16 ),  block .hash_int )
876+             assert_equal (node .getbestblockhash (), block .hash_hex )
877877
878878            # Nothing bad should happen if we get a late fill from the first peer... 
879879            stalling_peer .send_and_ping (msg )
0 commit comments