-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
multi: fix inconsistent state in gossip syncer #9424
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
001e559
multi: add debug logs for edge policy flow
yyforyongyu eb2b0c7
graph: fix `staticcheck` suggestion
yyforyongyu 4b30b09
discovery: add new method `handleSyncingChans`
yyforyongyu 9fecfed
discovery: fix race access to syncer's state
yyforyongyu 772a9d5
discovery: fix mocked peer in unit tests
yyforyongyu 56ff6d1
docs: update release notes
yyforyongyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -808,6 +808,8 @@ func (d *AuthenticatedGossiper) stop() { | |
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message, | ||
peer lnpeer.Peer) chan error { | ||
|
||
log.Debugf("Processing remote msg %T from peer=%x", msg, peer.PubKey()) | ||
|
||
errChan := make(chan error, 1) | ||
|
||
// For messages in the known set of channel series queries, we'll | ||
|
@@ -830,9 +832,13 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message, | |
|
||
// If we've found the message target, then we'll dispatch the | ||
// message directly to it. | ||
syncer.ProcessQueryMsg(m, peer.QuitSignal()) | ||
err := syncer.ProcessQueryMsg(m, peer.QuitSignal()) | ||
if err != nil { | ||
log.Errorf("Process query msg from peer %x got %v", | ||
peer.PubKey(), err) | ||
} | ||
|
||
errChan <- nil | ||
errChan <- err | ||
return errChan | ||
|
||
// If a peer is updating its current update horizon, then we'll dispatch | ||
|
@@ -2371,7 +2377,8 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(nMsg *networkMsg, | |
timestamp := time.Unix(int64(nodeAnn.Timestamp), 0) | ||
|
||
log.Debugf("Processing NodeAnnouncement: peer=%v, timestamp=%v, "+ | ||
"node=%x", nMsg.peer, timestamp, nodeAnn.NodeID) | ||
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID, | ||
nMsg.source.SerializeCompressed()) | ||
|
||
// We'll quickly ask the router if it already has a newer update for | ||
// this node so we can skip validating signatures if not required. | ||
|
@@ -2430,7 +2437,8 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(nMsg *networkMsg, | |
// TODO(roasbeef): get rid of the above | ||
|
||
log.Debugf("Processed NodeAnnouncement: peer=%v, timestamp=%v, "+ | ||
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. I'll try get around to updating the gossiper to use structured logging. That way we only need to add all this to the context once and then can just |
||
"node=%x", nMsg.peer, timestamp, nodeAnn.NodeID) | ||
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID, | ||
nMsg.source.SerializeCompressed()) | ||
|
||
return announcements, true | ||
} | ||
|
@@ -3034,9 +3042,9 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg, | |
edgeToUpdate = e2 | ||
} | ||
|
||
log.Debugf("Validating ChannelUpdate: channel=%v, from node=%x, has "+ | ||
"edge=%v", chanInfo.ChannelID, pubKey.SerializeCompressed(), | ||
edgeToUpdate != nil) | ||
log.Debugf("Validating ChannelUpdate: channel=%v, for node=%x, has "+ | ||
"edge policy=%v", chanInfo.ChannelID, | ||
pubKey.SerializeCompressed(), edgeToUpdate != nil) | ||
|
||
// Validate the channel announcement with the expected public key and | ||
// channel capacity. In the case of an invalid channel update, we'll | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
could you explain why the chainSyncer remaining in the
waitingQueryChanReply
will cause the chan_announcments received from the peer directly to not be relayed ?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.
yeah it's very intertwined...so we skip broadcasting channel anns from our peers here,
lnd/discovery/gossiper.go
Lines 1574 to 1580 in e0a920a
and the
shouldBroadcast
is determined here,lnd/discovery/gossiper.go
Lines 1533 to 1535 in e0a920a
which relies on this method,
lnd/discovery/sync_manager.go
Lines 806 to 811 in e0a920a
and the var
initialHistoricalSyncCompleted
is marked via,lnd/discovery/sync_manager.go
Lines 800 to 804 in e0a920a
and the above method is called inside
processChanRangeReply
here,lnd/discovery/syncer.go
Lines 951 to 954 in e0a920a
and the
processChanRangeReply
is called here,lnd/discovery/syncer.go
Lines 528 to 537 in e0a920a
Note that it be blocked on
case msg := <-g.gossipMsgs:
, as the msg is never sent to the channel here,lnd/discovery/syncer.go
Lines 1515 to 1532 in e0a920a
As the above
case *lnwire.ReplyChannelRange, *lnwire.ReplyShortChanIDsEnd:
will error out due to the state of the syncer not being updated towaitingQueryRangeReply
yet.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.
Thanks for the detailed explanation, agree really nested.