10
10
import random
11
11
12
12
from test_framework .blocktools import create_block , create_coinbase , add_witness_commitment
13
- from test_framework .messages import BlockTransactions , BlockTransactionsRequest , calculate_shortid , CBlock , CBlockHeader , CInv , COutPoint , CTransaction , CTxIn , CTxInWitness , CTxOut , FromHex , HeaderAndShortIDs , msg_no_witness_block , msg_no_witness_blocktxn , msg_cmpctblock , msg_getblocktxn , msg_getdata , msg_getheaders , msg_headers , msg_inv , msg_sendcmpct , msg_sendheaders , msg_tx , msg_block , msg_blocktxn , MSG_BLOCK , MSG_WITNESS_FLAG , NODE_NETWORK , P2PHeaderAndShortIDs , PrefilledTransaction , ser_uint256 , ToHex
13
+ from test_framework .messages import BlockTransactions , BlockTransactionsRequest , calculate_shortid , CBlock , CBlockHeader , CInv , COutPoint , CTransaction , CTxIn , CTxInWitness , CTxOut , FromHex , HeaderAndShortIDs , msg_no_witness_block , msg_no_witness_blocktxn , msg_cmpctblock , msg_getblocktxn , msg_getdata , msg_getheaders , msg_headers , msg_inv , msg_sendcmpct , msg_sendheaders , msg_tx , msg_block , msg_blocktxn , MSG_BLOCK , MSG_CMPCT_BLOCK , MSG_WITNESS_FLAG , NODE_NETWORK , P2PHeaderAndShortIDs , PrefilledTransaction , ser_uint256 , ToHex
14
14
from test_framework .mininode import mininode_lock , P2PInterface
15
15
from test_framework .script import CScript , OP_TRUE , OP_DROP
16
16
from test_framework .test_framework import BitcoinTestFramework
@@ -307,7 +307,7 @@ def test_compactblock_construction(self, test_node, use_witness_address=True):
307
307
# Now fetch the compact block using a normal non-announce getdata
308
308
with mininode_lock :
309
309
test_node .clear_block_announcement ()
310
- inv = CInv (4 , block_hash ) # 4 == "CompactBlock"
310
+ inv = CInv (MSG_CMPCT_BLOCK , block_hash )
311
311
test_node .send_message (msg_getdata ([inv ]))
312
312
313
313
wait_until (test_node .received_block_announcement , timeout = 30 , lock = mininode_lock )
@@ -634,7 +634,7 @@ def test_compactblocks_not_at_tip(self, test_node):
634
634
wait_until (test_node .received_block_announcement , timeout = 30 , lock = mininode_lock )
635
635
636
636
test_node .clear_block_announcement ()
637
- test_node .send_message (msg_getdata ([CInv (4 , int (new_blocks [0 ], 16 ))]))
637
+ test_node .send_message (msg_getdata ([CInv (MSG_CMPCT_BLOCK , int (new_blocks [0 ], 16 ))]))
638
638
wait_until (lambda : "cmpctblock" in test_node .last_message , timeout = 30 , lock = mininode_lock )
639
639
640
640
test_node .clear_block_announcement ()
@@ -643,7 +643,7 @@ def test_compactblocks_not_at_tip(self, test_node):
643
643
test_node .clear_block_announcement ()
644
644
with mininode_lock :
645
645
test_node .last_message .pop ("block" , None )
646
- test_node .send_message (msg_getdata ([CInv (4 , int (new_blocks [0 ], 16 ))]))
646
+ test_node .send_message (msg_getdata ([CInv (MSG_CMPCT_BLOCK , int (new_blocks [0 ], 16 ))]))
647
647
wait_until (lambda : "block" in test_node .last_message , timeout = 30 , lock = mininode_lock )
648
648
with mininode_lock :
649
649
test_node .last_message ["block" ].block .calc_sha256 ()
0 commit comments