diff --git a/src/services/main/watchdog.ts b/src/services/main/watchdog.ts index 50bd7873..778e09ce 100644 --- a/src/services/main/watchdog.ts +++ b/src/services/main/watchdog.ts @@ -196,19 +196,15 @@ export class Watchdog { const knownMaxIndex = Math.max(maxFromDb, this.latestPaymentIndexOffset) const newLatest = await this.lnd.GetLatestPaymentIndex(knownMaxIndex) const historyMismatch = newLatest > knownMaxIndex - if (historyMismatch) { - this.log("Payment index advanced from", knownMaxIndex, "to", newLatest, "- updating offset (likely LND restart or external payment)") - this.latestPaymentIndexOffset = newLatest - } const other = { ilnd: this.initialLndBalance, hf: this.accumulatedHtlcFees, iu: this.initialUsersBalance, tu: totalUsersBalance, km: knownMaxIndex, nl: newLatest, oext: otherExternal } //getLogger({ component: 'watchdog_debug2' })(JSON.stringify({ deltaLnd, deltaUsers, totalExternal, other })) const deny = await this.checkBalanceUpdate(deltaLnd, deltaUsers) + if (historyMismatch) { + getLogger({ component: 'bark' })("History mismatch detected in absolute update, locking outgoing operations") + this.lnd.LockOutgoingOperations() + return + } if (deny) { - if (historyMismatch) { - getLogger({ component: 'bark' })("Balance mismatch with unexpected payment history, locking outgoing operations") - this.lnd.LockOutgoingOperations() - return - } this.log("Balance mismatch detected in absolute update, but history is ok") } this.lnd.UnlockOutgoingOperations()