-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net processing: Tolerate sendheaders and sendcmpct messages before verack #20599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net processing: Tolerate sendheaders and sendcmpct messages before verack #20599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
2a942d4
to
f72a624
Compare
ACK f72a624 |
I'm wondering whether this is a good allocation of review resources? At the same time, it's not like the review is super-easy. We had this code working for years now, and now we might miss some corner case of an attacker sending us something while on-VERACK structs are not even initialized yet. Or perhaps if you're planning to rearrange sending signal messages, then I see the point. |
f72a624
to
427f573
Compare
We don't initialize any structs in verack processing. verack processing simply sets
How you allocate your time is up to you. If you don't think this is worth reviewing, then please don't feel under any obligation to spend time on it. |
rebased |
@jnewbery Just to understand the context of this change: is this purely a "follow the BIP" change, or is there any known scenario in which this change would improve interoperability with any currently existing client? |
This is purely to follow the BIP. I don't know of any client that sends send* messages before verack. However, future clients may wish to do so (since that's a more rational place to negotiate features). |
Concept ACK, IIUC correctly from a quick glance, the point of this PR is move-only of the hunk, from after the following "unsupported message" conditional to before it, confirm? if (!pfrom.fSuccessfullyConnected) {
LogPrint(BCLog::NET, "Unsupported message \"%s\" prior to verack from peer=%d\n", SanitizeString(msg_type), pfrom.GetId());
return;
} Should a proposal be made to update the BIPs on this point, similarly to BIPS 155/339? |
Correct, this PR moves the processing of sendheaders and sendcmpct to before the
No, this change is simply updating our behaviour to be consistent with those BIPs (since neither specify when the message should be sent). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 427f573
Lightly tested with blockfilterindex and peerbloomfilters enabled.
For a bit more context, I'd like to make the following change at some point: Introduce a
Then
That makes the state machine much more explicit. |
🕵️ @sipa has been requested to review this pull request as specified in the REVIEWERS file. |
rebased |
427f573
to
82d0a43
Compare
Code review ACK 82d0a43 |
Code review re-ACK 82d0a43 per |
Code review ACK 82d0a43 |
…erack BIP 130 (sendheaders) and BIP 152 (compact blocks) do not specify at which stage the `sendheaders` or `sendcmpct` messages should be sent. Therefore we should tolerate them being sent before the version-verack handshake is complete.
rebased |
82d0a43
to
b316dcb
Compare
review ACK b316dcb 📒 Show signature and timestampSignature:
Timestamp of file with hash |
Code review re-ACK b316dcb per |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK b316dcb, only code movement from after verack check to before
BIP 130 (sendheaders) and BIP 152 (compact blocks) do not specify at
which stage the
sendheaders
orsendcmpct
messages should be sent.Therefore we should tolerate them being sent before the version-verack
handshake is complete.