diff --git a/src/services/lnd/lnd.ts b/src/services/lnd/lnd.ts index ce19eae5..fb3815dd 100644 --- a/src/services/lnd/lnd.ts +++ b/src/services/lnd/lnd.ts @@ -142,20 +142,15 @@ export default class { return new Promise((res, rej) => { const interval = setInterval(async () => { try { - const info = await this.GetInfo() - if (!info.syncedToChain || !info.syncedToGraph) { - this.log("LND responding but not synced yet, waiting...") - return - } + await this.GetInfo() clearInterval(interval) this.ready = true res() } catch (err) { this.log(INFO, "LND is not ready yet, will try again in 1 second") - } - if (Date.now() - now > 1000 * 60 * 10) { - clearInterval(interval) - rej(new Error("LND not synced after 10 minutes")) + if (Date.now() - now > 1000 * 60) { + rej(new Error("LND not ready after 1 minute")) + } } }, 1000) }) diff --git a/src/services/main/watchdog.ts b/src/services/main/watchdog.ts index 3c12b676..d9d585ba 100644 --- a/src/services/main/watchdog.ts +++ b/src/services/main/watchdog.ts @@ -238,17 +238,13 @@ 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 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()