-
Notifications
You must be signed in to change notification settings - Fork 2.2k
server: prevent duplicate onion addresses in getinfo #10341
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?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -3279,7 +3279,16 @@ func (s *server) createNewHiddenService(ctx context.Context) error { | |
| // address it can be reached at to our list of advertised addresses. | ||
| newNodeAnn, err := s.genNodeAnnouncement( | ||
| nil, func(currentAnn *lnwire.NodeAnnouncement1) { | ||
| currentAnn.Addresses = append(currentAnn.Addresses, addr) | ||
| // Check if this address was already added. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will the whole list be deleted during restart, so we only have like 1 address in there at least 1 onion address I mean ? |
||
| for _, anAddr := range currentAnn.Addresses { | ||
| if anAddr.String() == addr.String() { | ||
| return | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can use some debug log here |
||
| } | ||
| } | ||
|
|
||
| currentAnn.Addresses = append( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like |
||
| currentAnn.Addresses, addr, | ||
| ) | ||
| }, | ||
| ) | ||
| if err != nil { | ||
|
|
||
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.
This comment explains what the code does, but not why. According to the style guide, comments should explain the why or the intention of the code.12
Style Guide References
Footnotes