fix merge err
This commit is contained in:
parent
ad599dd565
commit
0444e6d594
2 changed files with 8 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ export class Watchdog {
|
||||||
lnd: LightningHandler;
|
lnd: LightningHandler;
|
||||||
settings: WatchdogSettings;
|
settings: WatchdogSettings;
|
||||||
log = getLogger({ appName: "watchdog" })
|
log = getLogger({ appName: "watchdog" })
|
||||||
|
enabled = false
|
||||||
constructor(settings: WatchdogSettings, lnd: LightningHandler) {
|
constructor(settings: WatchdogSettings, lnd: LightningHandler) {
|
||||||
this.lnd = lnd;
|
this.lnd = lnd;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
@ -23,6 +24,7 @@ export class Watchdog {
|
||||||
SeedLndBalance = async (totalUsersBalance: number) => {
|
SeedLndBalance = async (totalUsersBalance: number) => {
|
||||||
this.initialLndBalance = await this.getTotalLndBalance()
|
this.initialLndBalance = await this.getTotalLndBalance()
|
||||||
this.initialUsersBalance = totalUsersBalance
|
this.initialUsersBalance = totalUsersBalance
|
||||||
|
this.enabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
getTotalLndBalance = async () => {
|
getTotalLndBalance = async () => {
|
||||||
|
|
@ -77,6 +79,10 @@ export class Watchdog {
|
||||||
|
|
||||||
PaymentRequested = async (totalUsersBalance: number) => {
|
PaymentRequested = async (totalUsersBalance: number) => {
|
||||||
this.log("Payment requested, checking balance")
|
this.log("Payment requested, checking balance")
|
||||||
|
if (!this.enabled) {
|
||||||
|
this.log("WARNING! Watchdog not enabled, skipping balance check")
|
||||||
|
return
|
||||||
|
}
|
||||||
const totalLndBalance = await this.getTotalLndBalance()
|
const totalLndBalance = await this.getTotalLndBalance()
|
||||||
const deltaLnd = totalLndBalance - this.initialLndBalance
|
const deltaLnd = totalLndBalance - this.initialLndBalance
|
||||||
const deltaUsers = totalUsersBalance - this.initialUsersBalance
|
const deltaUsers = totalUsersBalance - this.initialUsersBalance
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ export const initMainHandler = async (log: PubLogger, mainSettings: MainSettings
|
||||||
const mainHandler = new Main(mainSettings, storageManager)
|
const mainHandler = new Main(mainSettings, storageManager)
|
||||||
await mainHandler.lnd.Warmup()
|
await mainHandler.lnd.Warmup()
|
||||||
if (!mainSettings.skipSanityCheck) {
|
if (!mainSettings.skipSanityCheck) {
|
||||||
await mainHandler.VerifyEventsLog()
|
const totalUsersBalance = await mainHandler.VerifyEventsLog()
|
||||||
|
await mainHandler.paymentManager.watchDog.SeedLndBalance(totalUsersBalance)
|
||||||
}
|
}
|
||||||
const appsData = await mainHandler.storage.applicationStorage.GetApplications()
|
const appsData = await mainHandler.storage.applicationStorage.GetApplications()
|
||||||
const existingWalletApp = await appsData.find(app => app.name === 'wallet' || app.name === 'wallet-test')
|
const existingWalletApp = await appsData.find(app => app.name === 'wallet' || app.name === 'wallet-test')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue