Compare commits
15 commits
0332a5a34f
...
46ea632a87
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46ea632a87 | ||
|
|
581e46df65 | ||
|
|
e2b19e9275 | ||
|
|
22c3ec1ed6 | ||
|
|
e19dcb742b | ||
|
|
47a05c344d | ||
|
|
2417847eef | ||
|
|
654d6ba7f2 | ||
|
|
b007d03307 | ||
|
|
4981bd16eb | ||
|
|
27cde76bc1 | ||
|
|
c32aeee74c | ||
|
|
c11276a36f | ||
|
|
a6acf3dffc | ||
|
|
e6513b4797 |
1 changed files with 9 additions and 5 deletions
|
|
@ -196,15 +196,19 @@ 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 other = { ilnd: this.initialLndBalance, hf: this.accumulatedHtlcFees, iu: this.initialUsersBalance, tu: totalUsersBalance, km: knownMaxIndex, nl: newLatest, oext: otherExternal }
|
const other = { ilnd: this.initialLndBalance, hf: this.accumulatedHtlcFees, iu: this.initialUsersBalance, tu: totalUsersBalance, km: knownMaxIndex, nl: newLatest, oext: otherExternal }
|
||||||
//getLogger({ component: 'watchdog_debug2' })(JSON.stringify({ deltaLnd, deltaUsers, totalExternal, other }))
|
//getLogger({ component: 'watchdog_debug2' })(JSON.stringify({ deltaLnd, deltaUsers, totalExternal, other }))
|
||||||
const deny = await this.checkBalanceUpdate(deltaLnd, deltaUsers)
|
const deny = await this.checkBalanceUpdate(deltaLnd, deltaUsers)
|
||||||
|
if (deny) {
|
||||||
if (historyMismatch) {
|
if (historyMismatch) {
|
||||||
getLogger({ component: 'bark' })("History mismatch detected in absolute update, locking outgoing operations")
|
getLogger({ component: 'bark' })("Balance mismatch with unexpected payment history, locking outgoing operations")
|
||||||
this.lnd.LockOutgoingOperations()
|
this.lnd.LockOutgoingOperations()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (deny) {
|
|
||||||
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