You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace dual-sync-async persistence panic with Watch contract
Commit 0760f99 ("Disallow dual-sync-async persistence without
restarting") added a panic in non-test builds when a Persist
implementation returns both Completed and InProgress from the same
ChannelManager instance. However, this check runs against the status
that ChainMonitor returns to ChannelManager, not the raw Persist
result. When ChannelMonitor::update_monitor fails (e.g. a
counterparty commitment_signed arrives after a funding spend
confirms), ChainMonitor persists the full monitor successfully but
overrides the return value to InProgress. If the user's Persist impl
only ever returns Completed, this override triggers a false
mode-mismatch panic.
This replaces the panic with a cleaner contract at the Watch trait
level: a Watch implementation must not return Completed for a channel
update if there are still pending InProgress updates for that
channel. This matches the pure-async interface where an update cannot
complete until all prior updates have also completed. Persist
implementors are expected to be consistent (always sync or always
async), so ChainMonitor naturally satisfies this contract without
code changes.
The mode tracking and panic checks from 0760f99 are removed and
replaced with a panic that validates the new contract directly on
the in-flight update state. Legacy tests that switch the persister
between modes mid-flight can opt out via
Node::disable_monitor_completeness_assertion().
The chanmon_consistency fuzz target is also updated to propagate
monitor style changes to the live persister immediately rather than
only on reload. Switching to Completed is guarded to only take
effect when no channels have pending InProgress updates, satisfying
the new Watch contract.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments