Skip to content

feat: one-time stale channel monitor recovery#854

Closed
ben-kaufman wants to merge 1 commit intomasterfrom
fix/stale-monitor-recovery
Closed

feat: one-time stale channel monitor recovery#854
ben-kaufman wants to merge 1 commit intomasterfrom
fix/stale-monitor-recovery

Conversation

@ben-kaufman
Copy link
Contributor

Summary

  • On BuildException.ReadFailed, automatically retries build once with accept_stale_channel_monitors enabled
  • Persisted staleMonitorRecoveryAttempted SharedPreferences flag ensures one-time only
  • Flag set on any successful build (affected or not) — zero impact on unaffected users
  • Added @ApplicationContext to LightningService constructor for SharedPreferences access

How to test

  1. Reproduce the stale monitor state (overwrite a channel monitor in VSS with an older update_id)
  2. Launch the app — first build fails with ReadFailed
  3. Verify the retry succeeds and the node starts
  4. Check logs for "Stale monitor recovery: build succeeded with accept_stale"
  5. Keep app open ~15s, verify "all monitors healed" in logs
  6. Kill and relaunch — verify normal startup (no retry triggered)

Dependencies

🤖 Generated with Claude Code

On BuildException.ReadFailed (likely stale ChannelMonitor from migration
overwrite), automatically retry once with accept_stale_channel_monitors
enabled. The ldk-node recovery flag force-syncs the monitor's update_id
and heals commitment state via a delayed chain sync + keysend round-trip.

A persisted SharedPreferences flag ensures this only triggers once — set
on any successful build (affected or not), preventing future retries.

Depends on: synonymdev/ldk-node#76

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ovitrif
Copy link
Collaborator

ovitrif commented Mar 18, 2026

Closed in favour of:

@ovitrif ovitrif closed this Mar 18, 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