-
Notifications
You must be signed in to change notification settings - Fork 519
network: don't send VP in MOI messages if unsupported by remote peer #6484
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
Changes from all commits
0d5303f
1b3ab73
efcaf45
0ea0302
17b94a4
f00c333
8519ed7
dd55659
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1191,7 +1191,17 @@ func (wn *WebsocketNetwork) maybeSendMessagesOfInterest(peer *wsPeer, messagesOf | |||||||||||
| messagesOfInterestEnc = wn.messagesOfInterestEnc | ||||||||||||
| wn.messagesOfInterestMu.Unlock() | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if messagesOfInterestEnc != nil { | ||||||||||||
| // Filter VP tag for peers lacking stateful compression support | ||||||||||||
| // older nodes (<= v4.3) treat unknown tags as protocol violations and disconnect. | ||||||||||||
| if !peer.vpackStatefulCompressionSupported() { | ||||||||||||
| tags, err := unmarshallMessageOfInterest(messagesOfInterestEnc) | ||||||||||||
| if err == nil && tags[protocol.VotePackedTag] { | ||||||||||||
| delete(tags, protocol.VotePackedTag) | ||||||||||||
| messagesOfInterestEnc = marshallMessageOfInterestMap(tags) | ||||||||||||
|
||||||||||||
| messagesOfInterestEnc = marshallMessageOfInterestMap(tags) | |
| messagesOfInterestEnc = marshallMessageOfInterestMap(tags) | |
| } else if err != nil { | |
| wn.log.Warnf("Failed to unmarshal messagesOfInterest for peer %v: %v. Sending original MOI, which may be incompatible.", peer.addr, err) | |
| // Optionally, could skip sending or send a safe default here. |
Copilot
AI
Nov 5, 2025
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.
The code unmarshalls and remarshalls the MOI message for every legacy peer connection. Consider caching two versions of messagesOfInterestEnc (one with VP, one without) at the network level to avoid repeated serialization overhead when multiple legacy peers connect.
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.
Has this been changed for current nodes? I didn't realize that when we spoke offline.
If so, this can removed after next consensus update? Should we comment that way?
Maybe we should have a comment tag for that, it common up a lot.
// UNTILCONSENSUSor something.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.
it would be cool to have a comment like that because we often just leave a TODO message or github issue saying we can remove this later and forget