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.
net: Document what happens to getdata of unknown type #16188
pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:1906-netGetData changing 1 files +6 −0-
MarcoFalke commented at 3:30 PM on June 11, 2019: member
- DrahtBot added the label P2P on Jun 11, 2019
-
in src/net_processing.cpp:1544 in fa38f54378 outdated
1539 | @@ -1540,6 +1540,11 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm 1540 | } 1541 | } 1542 | 1543 | + // Unknown types in the GetData stay in vRecvGetData and block any future 1544 | + // getdata from this peer.
mzumsande commented at 4:25 PM on June 11, 2019:Wouldn't this not only block future GetData, but also all other messages from this peer, because of the line
if (!pfrom->vRecvGetData.empty()) return true;inProcessMessages()?
MarcoFalke commented at 5:24 PM on June 11, 2019:Indeed. In which case we might actually disconnect the peer, since there isn't anything that could happen on that connection anyway.
naumenkogs commented at 9:11 PM on June 11, 2019:This is also the only thing that prevents vRecvGetData from unbounded growth.
naumenkogs commented at 9:14 PM on June 11, 2019:Perhaps I'd suggest adding this note to
if (!pfrom->vRecvGetData.empty()) return true;, otherwise it's not obvious why we should do this check before processing new messages.
MarcoFalke commented at 9:17 PM on June 11, 2019:The comment there reads
// this maintains the order of responses
naumenkogs commented at 9:22 PM on June 11, 2019:Which does not really explain that removing this line would enable DoS :)
MarcoFalke commented at 2:49 PM on June 20, 2019:Thanks, done.
mzumsande approvedMarcoFalke renamed this:net: Document what happens to getdata of unknonw type
net: Document what happens to getdata of unknown type
on Jun 11, 2019fanquake requested review from sdaftuar on Jun 14, 2019fanquake requested review from morcos on Jun 14, 2019net: Document what happens to getdata of unknonw type dddd9270f8MarcoFalke commented at 2:49 PM on June 20, 2019: memberAddressed review by @mzumsande and @naumenkogs
MarcoFalke force-pushed on Jun 20, 2019MarcoFalke added the label Docs on Jun 20, 2019naumenkogs commented at 3:26 PM on June 20, 2019: memberACK
mzumsande commented at 3:39 PM on June 20, 2019: memberACK as well. This construction (upholding the connection with a peer we can never process a message from) doesn't make a lot of sense to me, but documenting it is good.
MarcoFalke commented at 3:51 PM on June 20, 2019: memberYeah, I'd say to disconnect the peer, but that should be done in a follow-up pull request.
sdaftuar commented at 2:38 AM on June 25, 2019: memberLooks right to me, but I haven't had a chance to verify that this is true with a test.
fanquake merged this on Jun 25, 2019fanquake closed this on Jun 25, 2019fanquake referenced this in commit 21bd6eb782 on Jun 25, 2019MarcoFalke deleted the branch on Jul 2, 2019deadalnix referenced this in commit d022eaaeac on Jun 17, 2020ftrader referenced this in commit 659385f552 on Aug 17, 2020PastaPastaPasta referenced this in commit c3dbd066aa on Jun 27, 2021PastaPastaPasta referenced this in commit b19a2100c8 on Jun 28, 2021PastaPastaPasta referenced this in commit 371ec30a53 on Jun 29, 2021PastaPastaPasta referenced this in commit 4d20b42841 on Jul 1, 2021PastaPastaPasta referenced this in commit 20ed20b7cf on Jul 1, 2021PastaPastaPasta referenced this in commit ca23beb346 on Jul 12, 2021PastaPastaPasta referenced this in commit e4060890f6 on Jul 13, 2021DrahtBot locked this on Dec 16, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC
More mirrored repositories can be found on mirror.b10c.me