Skip to content

Return Result from Watch::update_channel to separate monitor failure from persistence status#4445

Closed
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fix-freeze
Closed

Return Result from Watch::update_channel to separate monitor failure from persistence status#4445
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fix-freeze

Conversation

@joostjager
Copy link
Contributor

No description provided.

…from persistence status

Change Watch::update_channel to return Result<ChannelMonitorUpdateStatus, ()>
instead of bare ChannelMonitorUpdateStatus. This cleanly separates two
distinct concerns that were previously conflated:

- Ok(status): the persistence status (Completed, InProgress, or
  UnrecoverableError), representing whether the monitor was durably
  persisted.
- Err(()): ChannelMonitor::update_monitor failed internally, generally
  implying the channel has been closed on-chain.

Previously, ChainMonitor would override the Persist result to InProgress
when update_monitor failed, repurposing the async persistence mechanism
to freeze the channel. This was problematic because it could switch a
synchronous persister's channel into async mode, violating the
expectation that Completed and InProgress modes are not mixed.

Now, ChainMonitor returns Err(()) when update_monitor fails, and
ChannelManager maps this to InProgress behavior internally to freeze
the channel with minimal diff.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.96%. Comparing base (14e522f) to head (3ec6081).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4445      +/-   ##
==========================================
+ Coverage   85.94%   85.96%   +0.02%     
==========================================
  Files         159      159              
  Lines      104644   104649       +5     
  Branches   104644   104649       +5     
==========================================
+ Hits        89934    89960      +26     
+ Misses      12204    12185      -19     
+ Partials     2506     2504       -2     
Flag Coverage Δ
tests 85.96% <100.00%> (+0.02%) ⬆️

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.

@joostjager
Copy link
Contributor Author

Closing because of incompatibility with future remote chain monitor impls

@joostjager joostjager closed this Feb 26, 2026
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.

2 participants