Skip to content

Commit 21bd6eb

Browse files
committed
Merge #16188: net: Document what happens to getdata of unknown type
dddd927 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
2 parents e115a21 + dddd927 commit 21bd6eb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,11 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
15551555
}
15561556
}
15571557

1558+
// Unknown types in the GetData stay in vRecvGetData and block any future
1559+
// message from this peer, see vRecvGetData check in ProcessMessages().
1560+
// Depending on future p2p changes, we might either drop unknown getdata on
1561+
// the floor or disconnect the peer.
1562+
15581563
pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
15591564

15601565
if (!vNotFound.empty()) {
@@ -3260,6 +3265,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
32603265
return false;
32613266

32623267
// this maintains the order of responses
3268+
// and prevents vRecvGetData to grow unbounded
32633269
if (!pfrom->vRecvGetData.empty()) return true;
32643270
if (!pfrom->orphan_work_set.empty()) return true;
32653271

0 commit comments

Comments
 (0)