diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2020-04-27 14:00:21 -0700 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-05-15 07:42:07 +0800 |
commit | 1e73d7248a10863dc99a93f1db36d035c17f29d7 (patch) | |
tree | 875bbb3f0314b8cf6879c0eaac508c5dcf1c55c5 /src | |
parent | fb821731eb12906996bffdf4b3633d7fe47c85a7 (diff) | |
download | bitcoin-1e73d7248a10863dc99a93f1db36d035c17f29d7.tar.xz |
[net processing] ignore unknown INV types in GETDATA messages
Co-Authored-By: John Newbery <john@johnnewbery.com>
Github-Pull: #18808
Rebased-From: e257cf71c851e25e1a533bf1d4296f6b55c81332
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 01067e58a6..a6f9445a9d 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1614,18 +1614,14 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm } // release cs_main if (it != pfrom->vRecvGetData.end() && !pfrom->fPauseSend) { - const CInv &inv = *it; + const CInv &inv = *it++; if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK || inv.type == MSG_CMPCT_BLOCK || inv.type == MSG_WITNESS_BLOCK) { - it++; ProcessGetBlockData(pfrom, chainparams, inv, connman); } + // else: If the first item on the queue is an unknown type, we erase it + // and continue processing the queue on the next call. } - // Unknown types in the GetData stay in vRecvGetData and block any future - // message from this peer, see vRecvGetData check in ProcessMessages(). - // Depending on future p2p changes, we might either drop unknown getdata on - // the floor or disconnect the peer. - pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it); if (!vNotFound.empty()) { |