diff options
author | fanquake <fanquake@gmail.com> | 2019-06-25 10:57:10 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-06-25 11:12:37 +0800 |
commit | 21bd6eb782ca9a06d40c6876b11e7db6308275fb (patch) | |
tree | cc66b13d1eba2ec099c93b36b2a26819ae84351d | |
parent | e115a21f79c4121a78e7c889c17c3b5d3680d15b (diff) | |
parent | dddd9270f85bd2e71fd281a0c6b4053e02fce93c (diff) |
Merge #16188: net: Document what happens to getdata of unknown type
dddd9270f85bd2e71fd281a0c6b4053e02fce93c net: Document what happens to getdata of unknonw type (MarcoFalke)
Pull request description:
Any getdata of unknown type will never be processed and blocks all future messages from a peer. This isn't obviously clear from reading the code, so document it.
Top commit has no ACKs.
Tree-SHA512: 4f8e43bbe6534242facfcfffae28b7a6aa2d228841fa2146a87d494e69f614b0da23cf7a5f3d4367358a7c1981fe2ec196a21c437ae1653f1c7e0351be22598a
-rw-r--r-- | src/net_processing.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 5ff456fcb0..4b43b2cdf2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1555,6 +1555,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); if (!vNotFound.empty()) { @@ -3260,6 +3265,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter return false; // this maintains the order of responses + // and prevents vRecvGetData to grow unbounded if (!pfrom->vRecvGetData.empty()) return true; if (!pfrom->orphan_work_set.empty()) return true; |