@@ -158,7 +158,7 @@ def build_block_on_tip(self, node):
158
158
def make_utxos (self ):
159
159
block = self .build_block_on_tip (self .nodes [0 ])
160
160
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 )
162
162
self .generate (self .wallet , COINBASE_MATURITY )
163
163
164
164
total_value = block .vtx [0 ].vout [0 ].nValue
@@ -173,7 +173,7 @@ def make_utxos(self):
173
173
block2 .hashMerkleRoot = block2 .calc_merkle_root ()
174
174
block2 .solve ()
175
175
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 )
177
177
self .utxos .extend ([[tx .txid_int , i , out_value ] for i in range (10 )])
178
178
179
179
@@ -406,7 +406,7 @@ def test_compactblock_requests(self, test_node):
406
406
msg .block_transactions .blockhash = block .hash_int
407
407
msg .block_transactions .transactions = [block .vtx [0 ]]
408
408
test_node .send_and_ping (msg )
409
- assert_equal (int ( node .getbestblockhash (), 16 ), block .hash_int )
409
+ assert_equal (node .getbestblockhash (), block .hash_hex )
410
410
411
411
# Create a chain of transactions from given utxo, and add to a new block.
412
412
def build_block_with_transactions (self , node , utxo , num_transactions ):
@@ -555,7 +555,7 @@ def test_incorrect_blocktxn_response(self, test_node):
555
555
556
556
# Deliver the block
557
557
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 )
559
559
560
560
def test_getblocktxn_handler (self , test_node ):
561
561
node = self .nodes [0 ]
@@ -595,7 +595,7 @@ def test_getblocktxn_handler(self, test_node):
595
595
test_node .last_message .pop ("blocktxn" , None )
596
596
test_node .send_and_ping (msg )
597
597
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 )
599
599
assert "blocktxn" not in test_node .last_message
600
600
601
601
# Request with out-of-bounds tx index results in disconnect
@@ -651,7 +651,7 @@ def test_compactblocks_not_at_tip(self, test_node):
651
651
test_node .send_without_ping (msg_getdata ([CInv (MSG_CMPCT_BLOCK , int (new_blocks [0 ], 16 ))]))
652
652
test_node .wait_until (lambda : "block" in test_node .last_message , timeout = 30 )
653
653
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 ])
655
655
656
656
# Generate an old compactblock, and verify that it's not accepted.
657
657
cur_height = node .getblockcount ()
@@ -724,7 +724,7 @@ def test_invalid_tx_in_compactblock(self, test_node):
724
724
test_node .send_and_ping (msg )
725
725
726
726
# 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 )
728
728
test_node .sync_with_ping ()
729
729
730
730
# Helper for enabling cb announcements
@@ -761,7 +761,7 @@ def announce_cmpct_block(node, peer):
761
761
assert tx .txid_hex in mempool
762
762
763
763
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 )
765
765
766
766
self .utxos .append ([block .vtx [- 1 ].txid_int , 0 , block .vtx [- 1 ].vout [0 ].nValue ])
767
767
@@ -777,13 +777,13 @@ def announce_cmpct_block(node, peer):
777
777
778
778
cmpct_block .use_witness = True
779
779
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 )
781
781
782
782
msg = msg_no_witness_blocktxn ()
783
783
msg .block_transactions .blockhash = block .hash_int
784
784
msg .block_transactions .transactions = block .vtx [1 :]
785
785
stalling_peer .send_and_ping (msg )
786
- assert_equal (int ( node .getbestblockhash (), 16 ), block .hash_int )
786
+ assert_equal (node .getbestblockhash (), block .hash_hex )
787
787
788
788
def test_highbandwidth_mode_states_via_getpeerinfo (self ):
789
789
# 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):
839
839
msg .block_transactions .blockhash = block .hash_int
840
840
msg .block_transactions .transactions = block .vtx [1 :]
841
841
peer .send_and_ping (msg )
842
- assert_equal (int ( node .getbestblockhash (), 16 ), block .hash_int )
842
+ assert_equal (node .getbestblockhash (), block .hash_hex )
843
843
peer .clear_getblocktxn ()
844
844
845
845
# Test the simple parallel download case...
@@ -854,26 +854,26 @@ def announce_cmpct_block(node, peer, txn_count):
854
854
with p2p_lock :
855
855
# The second peer to announce should still get a getblocktxn
856
856
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 )
858
858
859
859
inbound_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
860
860
with p2p_lock :
861
861
# The third inbound peer to announce should *not* get a getblocktxn
862
862
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 )
864
864
865
865
outbound_peer .send_and_ping (msg_cmpctblock (cmpct_block .to_p2p ()))
866
866
with p2p_lock :
867
867
# The third peer to announce should get a getblocktxn if outbound
868
868
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 )
870
870
871
871
# Second peer completes the compact block first
872
872
msg = msg_blocktxn ()
873
873
msg .block_transactions .blockhash = block .hash_int
874
874
msg .block_transactions .transactions = block .vtx [1 :]
875
875
delivery_peer .send_and_ping (msg )
876
- assert_equal (int ( node .getbestblockhash (), 16 ), block .hash_int )
876
+ assert_equal (node .getbestblockhash (), block .hash_hex )
877
877
878
878
# Nothing bad should happen if we get a late fill from the first peer...
879
879
stalling_peer .send_and_ping (msg )
0 commit comments