Expose current dust exposure in ChannelDetails#4470
Expose current dust exposure in ChannelDetails#4470Bortlesboat wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
|
👋 I see @tankyleo was un-assigned. |
06585ba to
c571ad4
Compare
c571ad4 to
4f9b1e5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4470 +/- ##
==========================================
+ Coverage 86.01% 86.19% +0.17%
==========================================
Files 159 160 +1
Lines 105430 107554 +2124
Branches 105430 107554 +2124
==========================================
+ Hits 90690 92707 +2017
+ Misses 12229 12221 -8
- Partials 2511 2626 +115
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🔔 1st Reminder Hey @tankyleo! This PR has been waiting for your review. |
|
Quick follow-up from my side: I’m treating review-required PRs as top priority this week. If you want any specific changes, rebase, or split, I can turn them around quickly. |
4f9b1e5 to
03c307d
Compare
|
🔔 2nd Reminder Hey @tankyleo! This PR has been waiting for your review. |
03c307d to
b856d80
Compare
|
All the test fixture additions correctly use I've thoroughly reviewed every hunk in the diff. The only issue was the version string format ("0.3" vs "0.3.0") which was already flagged in the prior review. No new issues found. No new issues found. The only outstanding item is the version string format inconsistency ("0.3" vs "0.3.0") at |
|
🔔 3rd Reminder Hey @tankyleo! This PR has been waiting for your review. |
|
Hi @tankyleo — no worries if you're busy! Could another maintainer pick this up? Happy to address any feedback quickly. |
|
🔔 4th Reminder Hey @tankyleo! This PR has been waiting for your review. |
| outbound_capacity_msat, | ||
| next_outbound_htlc_limit_msat: available_capacity_msat, | ||
| next_outbound_htlc_minimum_msat, | ||
| dust_exposure_msat, |
There was a problem hiding this comment.
@TheBlueMatt it's a current quirk of the tx_buider API we currently report the dust exposure on the commitment that matches the local: bool parameter in NextCommitmentStats. With this PR we'd now also take the max of both the local and the remote commitments here, and report it in AvailableBalances.
Seems ok to me for now.
There was a problem hiding this comment.
Mmm, its weird that we return available_balances from get_channel_stats ignoring the local parameter but its true for the whole balances struct so...oh well.
lightning/src/ln/channel_state.rs
Outdated
| /// [`ChannelConfig::max_dust_htlc_exposure`] to determine whether new HTLCs can be | ||
| /// accepted or offered on this channel. | ||
| /// | ||
| /// This field will be `None` for objects serialized with LDK versions prior to 0.2.1. |
There was a problem hiding this comment.
The version here says "prior to 0.2.1" but Cargo.toml has version = "0.3.0+git", so this field will first appear in 0.3.0. The previous field (funding_redeem_script) correctly says "prior to 0.2.0".
| /// This field will be `None` for objects serialized with LDK versions prior to 0.2.1. | |
| /// This field will be `None` for objects serialized with LDK versions prior to 0.3.0. |
There was a problem hiding this comment.
Yep, claude is right - this will be shipped in 0.3. We should write "0.3" here (not "0.3.0", though).
|
Hi — tankyleo appears to be unavailable (4 reminders sent). Could another reviewer pick this up? It's a small addition exposing dust exposure values that are already computed internally. Happy to address any feedback. |
TheBlueMatt
left a comment
There was a problem hiding this comment.
Two small things, one that actually needs fixing, otherwise we'll land this. Thanks!
lightning/src/ln/channel_state.rs
Outdated
| /// [`ChannelConfig::max_dust_htlc_exposure`] to determine whether new HTLCs can be | ||
| /// accepted or offered on this channel. | ||
| /// | ||
| /// This field will be `None` for objects serialized with LDK versions prior to 0.2.1. |
There was a problem hiding this comment.
Yep, claude is right - this will be shipped in 0.3. We should write "0.3" here (not "0.3.0", though).
lightning/src/ln/channel.rs
Outdated
| /// threshold as well as any excess commitment transaction fees that contribute to dust | ||
| /// exposure. | ||
| /// | ||
| /// See [`ChannelConfig::max_dust_htlc_exposure`] for the config knob that limits this. |
There was a problem hiding this comment.
nit
| /// See [`ChannelConfig::max_dust_htlc_exposure`] for the config knob that limits this. | |
| /// See [`ChannelConfig::max_dust_htlc_exposure`] for more information on the dust calculation and to configure a limit. |
| outbound_capacity_msat, | ||
| next_outbound_htlc_limit_msat: available_capacity_msat, | ||
| next_outbound_htlc_minimum_msat, | ||
| dust_exposure_msat, |
There was a problem hiding this comment.
Mmm, its weird that we return available_balances from get_channel_stats ignoring the local parameter but its true for the whole balances struct so...oh well.
TheBlueMatt
left a comment
There was a problem hiding this comment.
Please feel free to squash the fixup commits down so that the git history only contains the one main commit
40ce774 to
515b244
Compare
Summary
Adds a
current_dust_exposure_msatfield toChannelDetailsthat surfaces the current total dust exposure on a channel.ChannelConfig::max_dust_htlc_exposureto monitor how close a channel is to its dust limitOption<u64>,Nonefor objects serialized prior to 0.2.1Implementation
dust_exposure_msattoAvailableBalances— computed asmax(local_dust_exposure_msat, remote_dust_exposure_msat)inget_available_balances(tx_builder.rs)current_dust_exposure_msat: Option<u64>toChannelDetailsstruct, populated from the balance computation infrom_channelFixes #2264