net: Document what happens to getdata of unknonw type

This commit is contained in:
MarcoFalke 2019-06-11 11:32:11 -04:00
parent 8a503a6c6d
commit dddd9270f8
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -1540,6 +1540,11 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
} }
} }
// 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); pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
if (!vNotFound.empty()) { if (!vNotFound.empty()) {
@ -3219,6 +3224,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
return false; return false;
// this maintains the order of responses // this maintains the order of responses
// and prevents vRecvGetData to grow unbounded
if (!pfrom->vRecvGetData.empty()) return true; if (!pfrom->vRecvGetData.empty()) return true;
if (!pfrom->orphan_work_set.empty()) return true; if (!pfrom->orphan_work_set.empty()) return true;