Compare commits
28 commits
bd0a657527
...
99d83efd56
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99d83efd56 | ||
|
|
17727d3e31 | ||
|
|
53945d7dcc | ||
|
|
a7fb92e26d | ||
|
|
8f38622395 | ||
|
|
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) => {
|
return new Promise<void>((res, rej) => {
|
||||||
const interval = setInterval(async () => {
|
const interval = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const info = await this.GetInfo()
|
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) {
|
||||||
if (Date.now() - now > 1000 * 60 * 10) {
|
rej(new Error("LND not ready after 1 minute"))
|
||||||
clearInterval(interval)
|
}
|
||||||
rej(new Error("LND not synced after 10 minutes"))
|
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -238,17 +238,13 @@ 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
|
||||||
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)
|
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 (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