-
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
wtclient: queue backup id only #7623
wtclient: queue backup id only #7623
Conversation
8fb70ad
to
aae7ad9
Compare
aae7ad9
to
117e419
Compare
Hey @guggero & @bitromortac :) This is a split off from #7380 so I think mostly reviewed already :) |
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.
tested, LGTM (I reviewed this in #7380) 💪. Do you have an estimate how much compression we get by this per backup @ellemouton?
Thanks for the review @bitromortac 🙏
The |
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.
Thank you for extracting those commits out. Almost ready, just a few small nits.
This commit just does some linting of the client_test.go file so that future commits are easier to parse.
A few lint fixes of the FetchChannel method.
This commit adds a small optimisation to the FetchChannel method. Instead of iterating over each channel bucket, an identifiable error is thrown once the wanted channel is found so that the iteration can stop early.
This commit introduces a new `channelSelector` method and moves all generic logic from `FetchChannel` to it. This refactor will make it easier to add new methods that require the same open-channel db traversal with slightly different channel selection logic.
Add a FetchChannelByID method that allows a caller to fetch an OpenChannel using an lnwire.ChannelID.
In this commit, a new BuildBreachRetribution callback is added to the tower client's Config struct. The main LND server provides the client with an implementation of the callback.
This commit fixes some lints in the wtclient package. This is done so that upcoming logic changes are easier to parse.
Since the TowerClient now has a callback that it can use to retrieve the retribution for a certain channel and commit height, let it use this call back instead of requiring the info to be passed to it through BackupState.
Only construct the retribution info at the time that the backup task is being bound to a session.
Since the retrubution info of a backup task is now only constructed at the time that the task is being bound to a session, the in-memory queue only needs to carry the BackupID of the task.
Lock the `backupMu` when accessing `c.chanCommitHeights` in the `New` function. It is not strictly necessary right now but good to add it so that there is no accidental oversight if the `perUpdate` method is ever extracted and reused in future.
117e419
to
9a1ed8c
Compare
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.
Nice 🔥 LGTM 🎉
Currently, the entire breach retribution struct is passed to the watchtower client
and queued in its task pipeline. This is no longer necessary with the changes made
in #7379 since it is now possible for the
tower client to build the breach retribution info on the fly.
So what this PR does is to now only queue the
wtdb.BackupID
of the update in thetask pipeline and reconstruct the breach retribution only at the time that it will be
required.
This PR sets up all the ground work that will be required for #7380
Flow of the PR
FetchChannelByID
method is added toChannelStateDB
to make itpossible to later on fetch a channel by its
lnwire.ChannelID
representation. The reason for this is that currently there is only a
FetchChannel
method which allows you to fetch a channel by itswire.Outpoint
but the tower client uses
lnwire.ChannelID
to keep track of channels so weneed a new lookup method here.
BreachRetribution at the time that it is needed, we create and pass through a
buildBreachRetribution
callback to the tower client.itself, we let it do that instead of having the
channellink
do that. Thisis to prepare for later on when we construct the breach info JIT.
a session.
carry the
BackupID
.