fix(watchdog): handle LND restarts without locking outgoing operations#902
Draft
PatMulligan wants to merge 1 commit intoshocknet:masterfrom
Draft
fix(watchdog): handle LND restarts without locking outgoing operations#902PatMulligan wants to merge 1 commit intoshocknet:masterfrom
PatMulligan wants to merge 1 commit intoshocknet:masterfrom
Conversation
e6513b4 to
bf4be80
Compare
When LND restarts, its payment index resets while the watchdog's cached latestPaymentIndexOffset remains at the old value. On the next check, the watchdog detects a "history mismatch" (newLatest > knownMaxIndex) and immediately locks outgoing operations — even when the balance is perfectly fine. This fix: 1. Updates latestPaymentIndexOffset to catch up when a gap is detected 2. Only locks outgoing operations when BOTH a history mismatch AND a balance discrepancy are present Previously, any LND restart required a manual Lightning.Pub restart to clear the lock. Now the watchdog gracefully handles LND reconnections while still protecting against actual payment history anomalies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bf4be80 to
40fb43b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
outgoing operations
actual state
security concern rather than a benign LND restart
Problem
The watchdog caches latestPaymentIndexOffset at startup. When LND restarts, the payment streams reconnect via Warmup(), but
this cache is never refreshed. The next watchdog check sees newLatest > knownMaxIndex and locks outgoing operations with
"History mismatch detected in absolute update, locking outgoing operations", even though the node balance is fine.
This means any LND restart (maintenance, crash recovery, upgrade) requires a manual Lightning.Pub restart to clear the lock.
Fix
In StartCheck(), when a payment index advance is detected:
Test plan
LP logs from test