-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[5/7]: multi: thread ChannelUpdate through codebase #8254
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: elle-g175-thread-interfaces-2
Are you sure you want to change the base?
[5/7]: multi: thread ChannelUpdate through codebase #8254
Conversation
c76c05b
to
96afa6e
Compare
74e232b
to
71e245c
Compare
96afa6e
to
5c11c93
Compare
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 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
In this commit, we pass the MessageSignerRing around in places where Schnorr signing will be needed to sign Gossip 1.75 messages.
Update the ChannelUpdate modifiers to use the lnwire.ChannelUpdate interface instead of *lnwire.ChannelUpdate1.
...interface instead of ChannelUpdate1.
In the IsKeepAlive and IsStaleEdgePolicy functions
5c11c93
to
e1b873e
Compare
71e245c
to
183d184
Compare
// SignMessageSchnorr signs the given message, single or double SHA256 | ||
// hashing it first, with the private key described in the key locator | ||
// and the optional Taproot tweak applied to the private key. | ||
SignMessageSchnorr(keyLoc KeyLocator, msg []byte, doubleHash bool, |
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 is the SingleKeyMessageSigner
(bound to a single pubkey), why does it need to accept a KeyLocator
? I think you instead want MessageSignerRing
if you wnat to be able to pass in ahother keyloc.
@@ -337,8 +336,7 @@ type Config struct { | |||
|
|||
// SignAliasUpdate is used to re-sign a channel update using the | |||
// remote's alias if the option-scid-alias feature bit was negotiated. | |||
SignAliasUpdate func(u *lnwire.ChannelUpdate1) (*ecdsa.Signature, | |||
error) | |||
SignAliasUpdate func(u lnwire.ChannelUpdate) error |
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.
Should update the godoc
, as IIUC now the sig will only be set in place instead of also being returned.
@@ -221,8 +220,7 @@ type Config struct { | |||
// option_scid_alias channels. This avoids a potential privacy leak by | |||
// replacing the public, confirmed SCID with the alias in the | |||
// ChannelUpdate. | |||
SignAliasUpdate func(u *lnwire.ChannelUpdate1) (*ecdsa.Signature, | |||
error) | |||
SignAliasUpdate func(u lnwire.ChannelUpdate) error |
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.
Same here re godoc
.
case *models.ChannelEdgePolicy1: | ||
return !timestamp.After(edge.LastUpdate) | ||
default: | ||
panic(fmt.Sprintf("unhandled: %T", edges[1])) |
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.
What about the chan upd2 case?
response.Code = lnrpc.Failure_EXPIRY_TOO_SOON | ||
response.ChannelUpdate = marshallChannelUpdate(&onionErr.Update) | ||
response.ChannelUpdate = update1 | ||
response.ChannelUpdate_2 = update2 |
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.
See comment on prior PR, I think we can just merge the two protos, and add a type field. This way clients will just work if they're wanting to consume updates over the streaming RPC.
flags lnwire.ChanUpdateChanFlags | ||
disabled bool | ||
|
||
direction bool |
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.
Missing godoc
comment.
} | ||
|
||
oldTimestamp := uint32(0) | ||
var ( | ||
older = false |
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.
👍
height := upd.BlockHeight | ||
|
||
edge1Height, edge2Height, exists, isZombie, err := | ||
b.cfg.Graph.HasChannelEdge2(chanID.ToUint64()) |
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 think if we can come up with an abstraction over the return values here (height vs timestamp), then we can condense this function a bit and eliminate some of the duplication.
@@ -3848,6 +3876,39 @@ func (d *AuthenticatedGossiper) ShouldDisconnect(pubkey *btcec.PublicKey) ( | |||
return false, nil | |||
} | |||
|
|||
func (d *AuthenticatedGossiper) updateWithinRebroadcastInterval( |
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.
Missing godoc
comment.
This is part of the Gossip 1.75 epic.
Depends on #8252 so only the last 14 commits are new
In this PR, we continue threading the new interfaces throughout the code base.
All that is done here is the threading of the new
lnwire.ChannelUpdate
interface throughthe code base. It is split into multiple commits for easier review.