Merge pull request #660 from shocknet/watchdog-init

unlink sanity check to watchdog
This commit is contained in:
boufni95 2024-03-26 21:08:06 +01:00 committed by GitHub
commit 00cde63194
2 changed files with 3 additions and 5 deletions

View file

@ -283,9 +283,6 @@ export default class {
throw new Error("sanity check on balance failed, expected: " + u.updatedBalance + " found: " + user.balance_sats)
}
}))
const total = await this.storage.paymentStorage.GetTotalUsersBalance()
return total || 0
}
checkUserEntry(e: LoggedEvent, u: { ts: number, updatedBalance: number } | undefined) {

View file

@ -18,9 +18,10 @@ export const initMainHandler = async (log: PubLogger, mainSettings: MainSettings
const mainHandler = new Main(mainSettings, storageManager)
await mainHandler.lnd.Warmup()
if (!mainSettings.skipSanityCheck) {
const totalUsersBalance = await mainHandler.VerifyEventsLog()
await mainHandler.paymentManager.watchDog.SeedLndBalance(totalUsersBalance)
await mainHandler.VerifyEventsLog()
}
const totalUsersBalance = await mainHandler.storage.paymentStorage.GetTotalUsersBalance()
await mainHandler.paymentManager.watchDog.SeedLndBalance(totalUsersBalance || 0)
const appsData = await mainHandler.storage.applicationStorage.GetApplications()
const existingWalletApp = await appsData.find(app => app.name === 'wallet' || app.name === 'wallet-test')
if (!existingWalletApp) {