Compare commits
23 commits
a574a5b817
...
5cc7f3998c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cc7f3998c | ||
|
|
c308d4be78 | ||
|
|
f1aa5d7139 | ||
|
|
9981e2628e | ||
|
|
ece75df22d | ||
|
|
c909cd660a | ||
|
|
5b88982fed | ||
|
|
4d19b55c57 | ||
|
|
071a27ad2d | ||
|
|
fee87e2741 | ||
|
|
ef53408485 | ||
|
|
1ad3166460 | ||
|
|
9499fdc923 | ||
|
|
a163215860 | ||
|
|
43efb63054 | ||
|
|
423c4e9c73 | ||
|
|
e7085e2ef3 | ||
|
|
7b33669b51 | ||
|
|
3c49b0fc07 | ||
|
|
9de5c1d982 | ||
|
|
b68129c316 | ||
|
|
0f3626869e | ||
|
|
e2389b9b27 |
2 changed files with 9 additions and 18 deletions
|
|
@ -142,20 +142,15 @@ export default class {
|
|||
return new Promise<void>((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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue