Skip to content
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

Include excess counterparty commitment transaction fees in dust exposure #3045

Merged
merged 6 commits into from May 7, 2024

Conversation

TheBlueMatt
Copy link
Collaborator

Transaction fees on counterparty commitment transactions are
ultimately not our money and thus are really "dust" from our PoV -
they're funds that may be ours during off-chain updates but are not
ours once we go on-chain.

Thus, here, we count any such fees in excess of our own fee
estimates towards dust exposure. We don't bother to make an
inbound/outbound channel distinction here as in most cases users
will use MaxDustExposure::FeeRateMultiplier which will scale
with the fee we set on outbound channels anyway.

Note that this also enables the dust exposure checks on anchor
channels during feerate updates. We'd previously elided these as
increases in the channel feerates do not change the HTLC dust
exposure, but now do for the fee dust exposure.

Also updates our default limit, fixing #2922

In most cases we already call both in a pair, and in fact always
consolidate some of the returned values across both accessors, so
there's not much reason to have them be separate methods.

Here we merge them.
The previous commit left indentation in `get_pending_htlc_stats`
deliberately wrong, to ease reviewability. This commit fixes the
indentation.
As LDK changes, `UserConfig::default()` may imply marginally
different behavior, whereas `test_default_channel_config` is
intended to tweak defaults to provide a stable behavior for test
contexts.

This commit changes a few uses of `UserConfig::default()` to
`test_default_channel_config` in cases that will fail over the
coming commits due to dust changes.
Transaction fees on counterparty commitment transactions are
ultimately not our money and thus are really "dust" from our PoV -
they're funds that may be ours during off-chain updates but are not
ours once we go on-chain.

Thus, here, we count any such fees in excess of our own fee
estimates towards dust exposure. We don't bother to make an
inbound/outbound channel distinction here as in most cases users
will use `MaxDustExposure::FeeRateMultiplier` which will scale
with the fee we set on outbound channels anyway.

Note that this also enables the dust exposure checks on anchor
channels during feerate updates. We'd previously elided these as
increases in the channel feerates do not change the HTLC dust
exposure, but now do for the fee dust exposure.
Now that we're including excess counterparty commitment transaction
fees in our dust calculation, we need to update the docs
accordingly. We do so here, describing some of the considerations
and risks that come with the new changes.

We also take this opportunity to double the default value, as users
have regularly complained that non-anchor channels fail to send
HTLCs with the default settings with some feerates.

Fixes lightningdevkit#2922
@TheBlueMatt TheBlueMatt added this to the 0.0.123 milestone May 7, 2024
@TheBlueMatt TheBlueMatt linked an issue May 7, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 94.03974% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 90.65%. Comparing base (8701b1b) to head (5091c1f).
Report is 37 commits behind head on main.

Files Patch % Lines
lightning/src/ln/channel.rs 93.49% 9 Missing and 2 partials ⚠️
lightning/src/ln/functional_tests.rs 94.53% 6 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3045      +/-   ##
==========================================
+ Coverage   89.16%   90.65%   +1.48%     
==========================================
  Files         118      118              
  Lines       97726   102485    +4759     
  Branches    97726   102485    +4759     
==========================================
+ Hits        87142    92904    +5762     
+ Misses       8345     7135    -1210     
- Partials     2239     2446     +207     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jkczyz
Copy link
Contributor

jkczyz commented May 7, 2024

Fuzz tests failing 😢

@TheBlueMatt
Copy link
Collaborator Author

Grr, its just the stupid no_existing_breakage test. I'll work on it but IMO we can merge it with that broken, cut an RC, and then fix for release.

Copy link
Contributor

@dunxen dunxen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the docs :)

@TheBlueMatt TheBlueMatt merged commit d1ac071 into lightningdevkit:main May 7, 2024
14 of 16 checks passed
TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this pull request May 7, 2024
…-are-dust

Include excess counterparty commitment transaction fees in dust exposure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rethink default dust limit
4 participants