Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

I noted in review for an unrelated PR that adding more per-channel logic in ChannelManager::get_and_clear_pending_msg_events really sucks for our performance, especially if it ends up hitting a sync monitor persistence. This made me wonder how far we actually are from not needing the holding check_free_holding_cells call that's currently there.

Turns out, at least according to our functional test coverage, the answer is "not very far".

Thus, here we drop it in favor of consistently calling a new util method on channels that might have the ability to release holding cell updates in the same lock where they change state, rather than waiting until get_and_clear_pending_msg_events.

We still process async monitor events in
get_and_clear_pending_msg_events, which can lead to channel (and monitor) updates, but that should only be the case for async persist applications, which then are likely to have fast ChannelMonitorUpdate in-line handling logic (cause its async).

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 17, 2026

👋 I see @tnull was un-assigned.
If you'd like another reviewer assignment, please click here.

I noted in review for an unrelated PR that adding more per-channel
logic in `ChannelManager::get_and_clear_pending_msg_events` really
sucks for our performance, especially if it ends up hitting a sync
monitor persistence. This made me wonder how far we actually are
from not needing the holding `check_free_holding_cells` call that's
currently there.

Turns out, at least according to our functional test coverage, the
answer is "not very far".

Thus, here we drop it in favor of consistently calling a new util
method on channels that might have the ability to release holding
cell updates in the same lock where they change state, rather than
waiting until `get_and_clear_pending_msg_events`.

We still process async monitor events in
`get_and_clear_pending_msg_events`, which can lead to channel (and
monitor) updates, but that should only be the case for async
persist applications, which then are likely to have fast
`ChannelMonitorUpdate` in-line handling logic (cause its async).
@TheBlueMatt TheBlueMatt force-pushed the 2026-01-live-holding-cells branch from d6c4618 to cad88af Compare January 17, 2026 13:27
@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 84.78261% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.62%. Comparing base (4281e49) to head (cad88af).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 84.78% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4320   +/-   ##
=======================================
  Coverage   86.61%   86.62%           
=======================================
  Files         158      158           
  Lines      102730   102752   +22     
  Branches   102730   102752   +22     
=======================================
+ Hits        88977    89006   +29     
+ Misses      11335    11332    -3     
+ Partials     2418     2414    -4     
Flag Coverage Δ
fuzzing 36.11% <64.04%> (-0.98%) ⬇️
tests 85.91% <84.78%> (+<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.

@tnull tnull self-requested a review January 19, 2026 08:57
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull @valentinewallace! 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.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Nice. I looked around to see if some of the calls could be consolidated, but it makes sense that the holding cell would have HTLCs to free on reestablish + monitor update + existing quiescence, basically. Everywhere seems to have test coverage.

}

if !post_event_actions.is_empty() {
let _read_guard = $self.total_consistency_lock.read().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use a comment IMO

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do it in a followup.

Copy link
Collaborator Author

@TheBlueMatt TheBlueMatt Jan 21, 2026

Choose a reason for hiding this comment

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

@valentinewallace
Copy link
Contributor

Not sure if @tnull wanted to take a look for a specific reason so guess I'll hold off on landing for the moment.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! 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.

@tnull tnull removed their request for review January 21, 2026 13:46
@tnull tnull merged commit 7785360 into lightningdevkit:main Jan 21, 2026
20 checks passed
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.

5 participants