@@ -300,8 +300,8 @@ def test_compactblock_construction(self, node, test_node, version, use_witness_a
300
300
assert (segwit_tx_generated ) # check that our test is not broken
301
301
302
302
# Wait until we've seen the block announcement for the resulting tip
303
- tip = int (self . nodes [ 0 ] .getbestblockhash (), 16 )
304
- assert (self . test_node .wait_for_block_announcement (tip ))
303
+ tip = int (node .getbestblockhash (), 16 )
304
+ assert (test_node .wait_for_block_announcement (tip ))
305
305
306
306
# Now mine a block, and look at the resulting compact block.
307
307
test_node .clear_block_announcement ()
@@ -589,8 +589,8 @@ def test_incorrect_blocktxn_response(self, node, test_node, version):
589
589
assert_equal (int (node .getbestblockhash (), 16 ), block .sha256 )
590
590
591
591
def test_getblocktxn_handler (self , node , test_node , version ):
592
- # bitcoind won't respond for blocks whose height is more than 15 blocks
593
- # deep.
592
+ # bitcoind will not send blocktxn responses for blocks whose height is
593
+ # more than 10 blocks deep.
594
594
MAX_GETBLOCKTXN_DEPTH = 10
595
595
chain_height = node .getblockcount ()
596
596
current_height = chain_height
@@ -623,11 +623,17 @@ def test_getblocktxn_handler(self, node, test_node, version):
623
623
test_node .last_blocktxn = None
624
624
current_height -= 1
625
625
626
- # Next request should be ignored, as we're past the allowed depth.
626
+ # Next request should send a full block response, as we're past the
627
+ # allowed depth for a blocktxn response.
627
628
block_hash = node .getblockhash (current_height )
628
629
msg .block_txn_request = BlockTransactionsRequest (int (block_hash , 16 ), [0 ])
630
+ with mininode_lock :
631
+ test_node .last_block = None
632
+ test_node .last_blocktxn = None
629
633
test_node .send_and_ping (msg )
630
634
with mininode_lock :
635
+ test_node .last_block .block .calc_sha256 ()
636
+ assert_equal (test_node .last_block .block .sha256 , int (block_hash , 16 ))
631
637
assert_equal (test_node .last_blocktxn , None )
632
638
633
639
def test_compactblocks_not_at_tip (self , node , test_node ):
@@ -648,6 +654,8 @@ def test_compactblocks_not_at_tip(self, node, test_node):
648
654
node .generate (1 )
649
655
wait_until (test_node .received_block_announcement , timeout = 30 )
650
656
test_node .clear_block_announcement ()
657
+ with mininode_lock :
658
+ test_node .last_block = None
651
659
test_node .send_message (msg_getdata ([CInv (4 , int (new_blocks [0 ], 16 ))]))
652
660
success = wait_until (lambda : test_node .last_block is not None , timeout = 30 )
653
661
assert (success )
0 commit comments