@@ -1555,7 +1555,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1555
1555
// disconnect node in case we have reached the outbound limit for serving historical blocks
1556
1556
if (send &&
1557
1557
connman.OutboundTargetReached (true ) &&
1558
- (((pindexBestHeader != nullptr ) && (pindexBestHeader->GetBlockTime () - pindex->GetBlockTime () > HISTORICAL_BLOCK_AGE)) || inv.type == MSG_FILTERED_BLOCK ) &&
1558
+ (((pindexBestHeader != nullptr ) && (pindexBestHeader->GetBlockTime () - pindex->GetBlockTime () > HISTORICAL_BLOCK_AGE)) || inv.IsMsgFilteredBlk () ) &&
1559
1559
!pfrom.HasPermission (PF_DOWNLOAD) // nodes with the download permission may exceed target
1560
1560
) {
1561
1561
LogPrint (BCLog::NET, " historical block serving limit reached, disconnect peer=%d\n " , pfrom.GetId ());
@@ -1581,7 +1581,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1581
1581
std::shared_ptr<const CBlock> pblock;
1582
1582
if (a_recent_block && a_recent_block->GetHash () == pindex->GetBlockHash ()) {
1583
1583
pblock = a_recent_block;
1584
- } else if (inv.type == MSG_WITNESS_BLOCK ) {
1584
+ } else if (inv.IsMsgWitnessBlk () ) {
1585
1585
// Fast-path: in this case it is possible to serve the block directly from disk,
1586
1586
// as the network format matches the format on disk
1587
1587
std::vector<uint8_t > block_data;
@@ -1598,12 +1598,11 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1598
1598
pblock = pblockRead;
1599
1599
}
1600
1600
if (pblock) {
1601
- if (inv.type == MSG_BLOCK)
1601
+ if (inv.IsMsgBlk ()) {
1602
1602
connman.PushMessage (&pfrom, msgMaker.Make (SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCK, *pblock));
1603
- else if (inv.type == MSG_WITNESS_BLOCK)
1603
+ } else if (inv.IsMsgWitnessBlk ()) {
1604
1604
connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, *pblock));
1605
- else if (inv.type == MSG_FILTERED_BLOCK)
1606
- {
1605
+ } else if (inv.IsMsgFilteredBlk ()) {
1607
1606
bool sendMerkleBlock = false ;
1608
1607
CMerkleBlock merkleBlock;
1609
1608
if (pfrom.m_tx_relay != nullptr ) {
@@ -1627,9 +1626,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1627
1626
}
1628
1627
// else
1629
1628
// no response
1630
- }
1631
- else if (inv.type == MSG_CMPCT_BLOCK)
1632
- {
1629
+ } else if (inv.IsMsgCmpctBlk ()) {
1633
1630
// If a peer is asking for old blocks, we're almost guaranteed
1634
1631
// they won't have a useful mempool to match against a compact block,
1635
1632
// and we don't feel like constructing the object for them, so
@@ -1757,7 +1754,7 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
1757
1754
// expensive to process.
1758
1755
if (it != pfrom.vRecvGetData .end () && !pfrom.fPauseSend ) {
1759
1756
const CInv &inv = *it++;
1760
- if (inv.type == MSG_BLOCK || inv. type == MSG_FILTERED_BLOCK || inv. type == MSG_CMPCT_BLOCK || inv. type == MSG_WITNESS_BLOCK ) {
1757
+ if (inv.IsGenBlkMsg () ) {
1761
1758
ProcessGetBlockData (pfrom, chainparams, inv, connman);
1762
1759
}
1763
1760
// else: If the first item on the queue is an unknown type, we erase it
@@ -2661,7 +2658,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
2661
2658
if (inv.IsMsgWtx ()) continue ;
2662
2659
}
2663
2660
2664
- if (inv.type == MSG_BLOCK ) {
2661
+ if (inv.IsMsgBlk () ) {
2665
2662
bool fAlreadyHave = AlreadyHaveBlock (inv.hash );
2666
2663
LogPrint (BCLog::NET, " got inv: %s %s peer=%d\n " , inv.ToString (), fAlreadyHave ? " have" : " new" , pfrom.GetId ());
2667
2664
0 commit comments