Skip to content

Commit e257cf7

Browse files
[net processing] ignore unknown INV types in GETDATA messages
Co-Authored-By: John Newbery <[email protected]>
1 parent 047ceac commit e257cf7

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
@@ -1645,18 +1645,14 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
16451645
} // release cs_main
16461646

16471647
if (it != pfrom->vRecvGetData.end() && !pfrom->fPauseSend) {
1648-
const CInv &inv = *it;
1648+
const CInv &inv = *it++;
16491649
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK || inv.type == MSG_CMPCT_BLOCK || inv.type == MSG_WITNESS_BLOCK) {
1650-
it++;
16511650
ProcessGetBlockData(pfrom, chainparams, inv, connman);
16521651
}
1652+
// else: If the first item on the queue is an unknown type, we erase it
1653+
// and continue processing the queue on the next call.
16531654
}
16541655

1655-
// Unknown types in the GetData stay in vRecvGetData and block any future
1656-
// message from this peer, see vRecvGetData check in ProcessMessages().
1657-
// Depending on future p2p changes, we might either drop unknown getdata on
1658-
// the floor or disconnect the peer.
1659-
16601656
pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
16611657

16621658
if (!vNotFound.empty()) {

0 commit comments

Comments
 (0)