Compare commits
14 commits
46ea632a87
...
0332a5a34f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0332a5a34f | ||
|
|
8fb8bb302f | ||
|
|
f7c06dec45 | ||
|
|
f1d8eb5383 | ||
|
|
c429b53f39 | ||
|
|
497ec7f375 | ||
|
|
7ea16286e0 | ||
|
|
819a263e98 | ||
|
|
74692a2102 | ||
|
|
e8a787694e | ||
|
|
23ce7e2614 | ||
|
|
e3b1f7580e | ||
|
|
92b9b2564f | ||
|
|
c96cf26d0e |
1 changed files with 5 additions and 9 deletions
|
|
@ -196,19 +196,15 @@ 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 (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