-
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
[2/?]: lnwallet+channeldb: add new AuxLeafStore for dynamic aux leaves #8684
Conversation
Pull reviewers statsStats of the last 30 days for lnd:
|
Important Auto Review SkippedAuto reviews are disabled on this repository. 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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
e04f50d
to
9f4677d
Compare
9f4677d
to
4969b5a
Compare
I can't approve the PR because I re-opened it. But I reviewed it and worked my feedback directly into the commits. Perhaps we'll want to wait for #8692 to be merged to fix the linter issue. But can also address that once we merge 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.
LGTM 🪁
I think it's missing a commit somewhere?
|
Oops, will fix. |
4969b5a
to
5baf204
Compare
Bumped |
08a6c9c
to
c4b9d94
Compare
5baf204
to
11f3626
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.
Looks good 🍀
@@ -72,116 +148,60 @@ var ( | |||
// made into tlv records without further conversion. | |||
type HTLCEntry struct { | |||
// RHash is the payment hash of the HTLC. | |||
RHash [32]byte | |||
RHash tlv.RecordT[tlv.TlvType0, SparsePayHash] |
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.
haven't fully wrapped my head around why we implemented sparse hash when we could have used fn.Option
?
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.
That's to remain backward compatibility with existing data in the database. The sparse hash writes the TLV type and a length of 0
while an optional record would not be written at all (so neither type nor length). So the encoding on disk would be different.
11f3626
to
4e807bb
Compare
c4b9d94
to
26ce8ee
Compare
In this commit, we update all the taproot scripts to also accept an optional aux leaf. This aux leaf can be used to add more redemption paths for advanced channels, or just as an extra commitment space.
In this commit, for each channel, we'll now start to store an optional custom blob. This can be used to store extra information for custom channels in an opauqe manner.
We'll need this later on to ensure we can always interact with the new aux blobs at all stages of commitment transaction construction.
In this commit, we also add the custom TLV blob to the internal commitment struct that we use within the in-memory commitment linked list. This'll be useful to ensure that we're tracking the current blob for our in memory commitment for when we need to write it to disk.
In this commit, we add some useful type definitions for the aux leaf.
In this commit, we add a new AuxLeafStore which can be used to dynamically fetch the latest aux leaves for a given state. This is useful for custom channel types that will store some extra information in the form of a custom blob, then will use that information to derive the new leaf tapscript leaves that may be attached to reach state.
This'll be useful for custom channel types that want to store extra information that'll be useful to help handle channel revocation cases.
This may be useful for custom channel types that base everything off the index (a global value) rather than the output index (can change with each state).
In this commit, we add a TLV blob to the PaymentDescriptor struct. We also now thread through this value from the UpdateAddHTLC message to the PaymentDescriptor mapping, and the other way around.
In this commit, we start to thread thru the new aux tap leaf structures to all relevant areas. This includes: commitment outputs, resolution creation, breach handling, and also HTLC scripts.
Depends/bases on #8683.
Replaces #8562 (with correct base branch and upstream feature branch).
In this commit, we add a new abstraction, the
AuxLeafStore
that's capable of dynamically deriving hte aux leaves for a new commitment state given the channel point and custom blob stored. The custom blob can be used by external programers to store custom information for a channel which can then be used to derive the aux leaves for each new state. All added features in this PR as optional, and if not set, don't alter the normal channel flow.NOTE: In this PR, I've started to also commit my local
go.work
files, as I have some submodules change, and committing thego.work
file allows the PR to build w/o any temporary commits or PRs.TODO
Summary by CodeRabbit
Link to all PRs in the saga: