Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

When we first added auto-archiving of resolved ChannelMonitors, we wanted to be somewhat cautious of flipping it on by default as archiving a ChannelMonitor too soon would be a critical bug and, while we were confident in it, we weren't 100%. Since then its been used extensively in various LDK deployments, including ldk-node.

Given its now seen substantial use, and performs an important anti-DoS function, here we flip to calling it by default on a new timer in lightning-background-processor.

Fixes #218

When we first added auto-archiving of resolved `ChannelMonitor`s,
we wanted to be somewhat cautious of flipping it on by default as
archiving a `ChannelMonitor` too soon would be a critical bug and,
while we were confident in it, we weren't 100%. Since then its been
used extensively in various LDK deployments, including `ldk-node`.

Given its now seen substantial use, and performs an important
anti-DoS function, here we flip to calling it by default on a new
timer in `lightning-background-processor`.

Fixes lightningdevkit#218
@TheBlueMatt TheBlueMatt added this to the 0.3 milestone Dec 16, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Dec 16, 2025

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull tnull self-requested a review December 16, 2025 17:03
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 92.43697% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.39%. Comparing base (62c5849) to head (ded972b).

Files with missing lines Patch % Lines
lightning-background-processor/src/lib.rs 92.43% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4288      +/-   ##
==========================================
+ Coverage   89.38%   89.39%   +0.01%     
==========================================
  Files         180      180              
  Lines      139834   139953     +119     
  Branches   139834   139953     +119     
==========================================
+ Hits       124985   125113     +128     
+ Misses      12262    12251      -11     
- Partials     2587     2589       +2     
Flag Coverage Δ
fuzzing 35.21% <ø> (ø)
tests 88.73% <92.43%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if archive_timer_elapsed {
log_trace!(logger, "Archiving stale ChannelMonitors.");
chain_monitor.archive_fully_resolved_channel_monitors();
have_archived = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I do wonder if we should have a more verbose return value and then use that to explicitly prune the corresponding OutputSweeper entries now, rather than just adding a buffer on top of the archival delay.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Possibly, yea, though if we're still concerned about it its much easier to double the prune delay in the sweeper...Either way seems unrelated to this PR (which just makes sure the sweeper works properly...)

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tankyleo! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

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.

Prune ChannelMonitors in background-processor

3 participants