-
Notifications
You must be signed in to change notification settings - Fork 402
Produce a single monitor update per commitment number #3738
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: main
Are you sure you want to change the base?
Produce a single monitor update per commitment number #3738
Conversation
tankyleo
commented
Apr 15, 2025
👋 Hi! I see this is a draft PR. |
2adce74
to
829402c
Compare
@TheBlueMatt this is what we've been discussing with @wpaulino can we get your impression of this approach ? Thank you. |
A high level overview of how I am thinking these new monitor updates will get produced on channel / tx-builder side:
|
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.
Design makes sense to me.
@TheBlueMatt note that going with this design will mean undoing a good chunk of the work in #3664 to no longer keep the non-dust sources separate. Should be fine as long as we get it shipped in the same release. |
(2, commitment_txs, required_vec), | ||
(4, claimed_htlcs, required_vec), | ||
}, | ||
(7, LatestCounterpartyCommitmentTXs) => { |
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 be even, and the members below should be odd
(0, htlc_data, required_vec), | ||
(2, commitment_txs, required_vec), | ||
(4, claimed_htlcs, required_vec), |
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 be odd
lightning/src/ln/chan_utils.rs
Outdated
(0, offered, required), | ||
(2, amount_msat, required), | ||
(4, cltv_expiry, required), | ||
(6, payment_hash, required), |
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 be odd
8fd9765
to
0b93e43
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3738 +/- ##
==========================================
+ Coverage 89.12% 89.19% +0.06%
==========================================
Files 156 156
Lines 123514 123984 +470
Branches 123514 123984 +470
==========================================
+ Hits 110086 110582 +496
+ Misses 10749 10734 -15
+ Partials 2679 2668 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Such updates will contain a single HTLC-source table for that commitment number, together with a vector of commitment transactions created at that commitment number. This vector will grow with the number of pending splices for a channel. The HTLC-source table produced by channel will stop storing information on which HTLCs were assigned which output index. Instead, this information will be stored in each commitment transaction in the monitor update. This commit deduplicates the `HTLCSource` collection for each commitment number, but `HTLCOutputData` would store information already stored in each `CommitmentTransaction` in a monitor update. This is a partial rework of b8a03cd. That commit has not been shipped in a release yet.
0b93e43
to
8ac0358
Compare
Why do we not want to keep them separate now? |
The HTLC-source table now no longer holds "dust-vs-nondust" data; that information is now solely stored in each So in the updates, we no longer have this concept of a "dust-vs-nondust source"; they are all part of a single vector that contains all the sources for this set of commitment transactions. |
Right, but why? I guess now because there's many commitment txn we will no longer rely on the HTLCs to be sorted in commitment-tx-order and so now it doesn't matter (and HTLCs could theoretically be dust in some commitments but not in others)? |
The HTLCs could be sorted in the same commitment tx order across funding scopes, but the transaction output indices of the HTLCs might vary, as which index the non-HTLC outputs get assigned to might vary across funding scopes - because of the different Right now though I don't see a way for a HTLC to be dust in one scope, and non-dust in another scope... but looks like this will change with dynamic commitments if I recall. Looking at BOLT PR 1117 yes - that is a proposal to vary the |
Right, so basically there's no point in splitting by dust/non-dust because we're not longer going to be able to rely on the order of the HTLCSources in the update, and instead now have to scan them when we need them, so we just shove them all in the update in a big heap cause it doesn't matter. Makes sense to me. |