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) }, 1000)
} }
AwaitProviderReady = async (res: (usable: boolean) => void) => { AwaitProviderReady = async (): Promise<boolean> => {
if (!this.pubDestination) { if (!this.pubDestination) {
res(false) return false
return
} }
if (this.latestMaxWithdrawable !== null) { if (this.latestMaxWithdrawable !== null) {
res(true) return true
return
} }
this.queue.push({ res }) return new Promise<boolean>(res => {
this.queue.push({ res })
})
} }
Stop = () => { Stop = () => {

View file

@ -236,9 +236,15 @@ export default class SanityChecker {
this.events = await this.storage.eventsLog.GetAllLogs() this.events = await this.storage.eventsLog.GetAllLogs()
this.invoices = (await this.lnd.GetAllPaidInvoices(1000)).invoices this.invoices = (await this.lnd.GetAllPaidInvoices(1000)).invoices
this.payments = (await this.lnd.GetAllPayments(1000)).payments this.payments = (await this.lnd.GetAllPayments(1000)).payments
const ops = await this.lnd.liquidProvider.GetOperations() const providerUsable = await this.lnd.liquidProvider.AwaitProviderReady()
this.providerInvoices = ops.latestIncomingInvoiceOperations.operations if (providerUsable) {
this.providerPayments = ops.latestOutgoingInvoiceOperations.operations 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.incrementSources = {}
this.decrementSources = {} this.decrementSources = {}
this.users = {} this.users = {}