-
Notifications
You must be signed in to change notification settings - Fork 2.2k
server.go: prevent partial mutation of currentNodeAnn
in server.genNodeAnnouncement
on netann.SignNodeAnnouncement
failures
#9815
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
base: master
Are you sure you want to change the base?
Conversation
In this commit, we prevent partial mutation of current node announcement during announcement signing. If node announcement signing failed the current node announcement becomes inconsistent.
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
currentNodeAnn
in server.genNodeAnnouncement
currentNodeAnn
in server.genNodeAnnouncement
on netann.SignNodeAnnouncement
failures
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.
I haven’t found a good way to test this yet or assess the potential for announcement inconsistencies. If you have any suggestions on how to approach that, I’d be happy to try them out. That said, the change does seem to add robustness overall 👍
I also believe this change deserves a mention in the release notes.
@@ -3454,17 +3459,20 @@ func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector, | |||
|
|||
// Apply the requested changes to the node announcement. |
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.
nit: consider updating the comment to reflect that the node announcement isn’t being modified yet.
Thanks for taking a look, @MPins! 🙏 This issue can be reproduced when You could simulate this error by:
Here are the relevant code references:
This issue regards partial mutation would become more obvious when we explicitly returns error here in func WriteNetAddrs(buf *bytes.Buffer, addresses []net.Addr) error {
...
case *DNSHostnameAddress:
if dnsHostnameAddressFound {
return errors.New("cannot advertise multiple " +
"DNS hostname addresses. See Bolt 07")
}
if err := WriteDNSHostnameAddr(addrBuf, a); err != nil {
return err
}
dnsHostnameAddressFound = true
}
@ellemouton – What do you think about this? |
Change Description
In this commit, we prevent partial mutation of the current node announcement during announcement signing. Previously, if node announcement signing failed, the current node announcement could become inconsistent.
Motivation and Context
This issue was discovered while working on issue #9455. Specifically, it was observed that:
The enforcement of a single DNS hostname address related to Bolt 07 occurs in
WriteNetAddrs
.If there’s is an error, the error is correctly propagated from
netann.SignNodeAnnouncement
.However, part of the current node announcement (e.g.,
Addresses []net.Addr
or CLI fielduris
fromgetinfo
) was still being updated, leading to inconsistencies when inspecting with the command:Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.