Compare commits
11 commits
99d83efd56
...
bd0a657527
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd0a657527 | ||
|
|
c71dd45ae8 | ||
|
|
4191bb11f4 | ||
|
|
a5cf1d8ceb | ||
|
|
e4777894db | ||
| 77e5772afd | |||
|
|
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) => {
|
return new Promise<void>((res, rej) => {
|
||||||
const interval = setInterval(async () => {
|
const interval = setInterval(async () => {
|
||||||
try {
|
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)
|
clearInterval(interval)
|
||||||
this.ready = true
|
this.ready = true
|
||||||
res()
|
res()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.log(INFO, "LND is not ready yet, will try again in 1 second")
|
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)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -238,13 +238,17 @@ export class Watchdog {
|
||||||
const knownMaxIndex = Math.max(maxFromDb, this.latestPaymentIndexOffset)
|
const knownMaxIndex = Math.max(maxFromDb, this.latestPaymentIndexOffset)
|
||||||
const newLatest = await this.lnd.GetLatestPaymentIndex(knownMaxIndex)
|
const newLatest = await this.lnd.GetLatestPaymentIndex(knownMaxIndex)
|
||||||
const historyMismatch = newLatest > knownMaxIndex
|
const historyMismatch = newLatest > knownMaxIndex
|
||||||
const deny = await this.checkBalanceUpdate(deltaLnd, deltaUsers)
|
|
||||||
if (historyMismatch) {
|
if (historyMismatch) {
|
||||||
getLogger({ component: 'bark' })("History mismatch detected in absolute update, locking outgoing operations")
|
this.log("Payment index advanced from", knownMaxIndex, "to", newLatest, "- updating offset (likely LND restart or external payment)")
|
||||||
this.lnd.LockOutgoingOperations()
|
this.latestPaymentIndexOffset = newLatest
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
const deny = await this.checkBalanceUpdate(deltaLnd, deltaUsers)
|
||||||
if (deny) {
|
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.log("Balance mismatch detected in absolute update, but history is ok")
|
||||||
}
|
}
|
||||||
this.lnd.UnlockOutgoingOperations()
|
this.lnd.UnlockOutgoingOperations()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue