Skip to content

Commit 1e73d72

Browse files
amitiuttarwarfanquake
authored andcommitted
[net processing] ignore unknown INV types in GETDATA messages
Co-Authored-By: John Newbery <[email protected]> Github-Pull: #18808 Rebased-From: e257cf7
1 parent fb82173 commit 1e73d72

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,18 +1614,14 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
16141614
} // release cs_main
16151615

16161616
if (it != pfrom->vRecvGetData.end() && !pfrom->fPauseSend) {
1617-
const CInv &inv = *it;
1617+
const CInv &inv = *it++;
16181618
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK || inv.type == MSG_CMPCT_BLOCK || inv.type == MSG_WITNESS_BLOCK) {
1619-
it++;
16201619
ProcessGetBlockData(pfrom, chainparams, inv, connman);
16211620
}
1621+
// else: If the first item on the queue is an unknown type, we erase it
1622+
// and continue processing the queue on the next call.
16221623
}
16231624

1624-
// Unknown types in the GetData stay in vRecvGetData and block any future
1625-
// message from this peer, see vRecvGetData check in ProcessMessages().
1626-
// Depending on future p2p changes, we might either drop unknown getdata on
1627-
// the floor or disconnect the peer.
1628-
16291625
pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
16301626

16311627
if (!vNotFound.empty()) {

0 commit comments

Comments
 (0)