This commit is contained in:
boufni95 2024-06-24 22:26:41 +02:00
parent 2dbbd6adde
commit 39b70c7b42
2 changed files with 15 additions and 9 deletions

View file

@ -47,16 +47,16 @@ export class LiquidityProvider {
}, 1000)
}
AwaitProviderReady = async (res: (usable: boolean) => void) => {
AwaitProviderReady = async (): Promise<boolean> => {
if (!this.pubDestination) {
res(false)
return
return false
}
if (this.latestMaxWithdrawable !== null) {
res(true)
return
return true
}
this.queue.push({ res })
return new Promise<boolean>(res => {
this.queue.push({ res })
})
}
Stop = () => {

View file

@ -236,9 +236,15 @@ export default class SanityChecker {
this.events = await this.storage.eventsLog.GetAllLogs()
this.invoices = (await this.lnd.GetAllPaidInvoices(1000)).invoices
this.payments = (await this.lnd.GetAllPayments(1000)).payments
const ops = await this.lnd.liquidProvider.GetOperations()
this.providerInvoices = ops.latestIncomingInvoiceOperations.operations
this.providerPayments = ops.latestOutgoingInvoiceOperations.operations
const providerUsable = await this.lnd.liquidProvider.AwaitProviderReady()
if (providerUsable) {
const ops = await this.lnd.liquidProvider.GetOperations()
this.providerInvoices = ops.latestIncomingInvoiceOperations.operations
this.providerPayments = ops.latestOutgoingInvoiceOperations.operations
} else {
this.log("provider not usable, skipping provider checks")
}
this.incrementSources = {}
this.decrementSources = {}
this.users = {}