Compare commits
20 commits
5cc7f3998c
...
a574a5b817
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a574a5b817 | ||
|
|
81f199a18a | ||
|
|
e3ec8676fb | ||
|
|
b115712c87 | ||
|
|
51ce89234e | ||
|
|
f048e71821 | ||
|
|
b2dbcd6a20 | ||
|
|
48bfc45bcf | ||
|
|
6725d4620b | ||
|
|
680cca6852 | ||
|
|
b08e7c134a | ||
|
|
adb581a018 | ||
|
|
21e3fc6ac0 | ||
|
|
7ef33441e3 | ||
|
|
0466ee673b | ||
|
|
72c9872b23 | ||
|
|
5e5e30c7a2 | ||
|
|
611eb4fc04 | ||
|
|
6512e10f08 | ||
|
|
e9b5dacb3b |
2 changed files with 17 additions and 8 deletions
|
|
@ -142,15 +142,20 @@ export default class {
|
|||
return new Promise<void>((res, rej) => {
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
await this.GetInfo()
|
||||
const info = await this.GetInfo()
|
||||
if (!info.syncedToChain || !info.syncedToGraph) {
|
||||
this.log("LND responding but not synced yet, waiting...")
|
||||
return
|
||||
}
|
||||
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) {
|
||||
rej(new Error("LND not ready after 1 minute"))
|
||||
}
|
||||
}
|
||||
if (Date.now() - now > 1000 * 60 * 10) {
|
||||
clearInterval(interval)
|
||||
rej(new Error("LND not synced after 10 minutes"))
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -238,13 +238,17 @@ export class Watchdog {
|
|||
const knownMaxIndex = Math.max(maxFromDb, this.latestPaymentIndexOffset)
|
||||
const newLatest = await this.lnd.GetLatestPaymentIndex(knownMaxIndex)
|
||||
const historyMismatch = newLatest > knownMaxIndex
|
||||
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
|
||||
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 (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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue