fix
This commit is contained in:
parent
f39a4d50bd
commit
5ddbc9b8f5
2 changed files with 5 additions and 5 deletions
|
|
@ -28,9 +28,9 @@ export class LiquidityProvider {
|
|||
queue: ((state: 'ready') => void)[] = []
|
||||
utils: Utils
|
||||
pendingPayments: Record<string, number> = {}
|
||||
updateProviderBalance: (balance: number) => void
|
||||
updateProviderBalance: (balance: number) => Promise<void>
|
||||
// make the sub process accept client
|
||||
constructor(pubDestination: string, utils: Utils, invoicePaidCb: InvoicePaidCb, updateProviderBalance: (balance: number) => void) {
|
||||
constructor(pubDestination: string, utils: Utils, invoicePaidCb: InvoicePaidCb, updateProviderBalance: (balance: number) => Promise<void>) {
|
||||
this.utils = utils
|
||||
if (!pubDestination) {
|
||||
this.log("No pub provider to liquidity provider, will not be initialized")
|
||||
|
|
@ -192,8 +192,8 @@ export class LiquidityProvider {
|
|||
this.log("error paying invoice", res.reason)
|
||||
throw new Error(res.reason)
|
||||
}
|
||||
delete this.pendingPayments[invoice]
|
||||
this.updateProviderBalance(userInfo.balance)
|
||||
|
||||
this.updateProviderBalance(userInfo.balance).then(() => { delete this.pendingPayments[invoice] })
|
||||
this.utils.stateBundler.AddTxPoint('paidAnInvoice', decodedAmount, { used: 'provider', from, timeDiscount: true })
|
||||
return res
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class RugPullTracker {
|
|||
}
|
||||
|
||||
checkForDisruption = async (pubDst: string, trackedBalance: number, providerTracker: TrackedProvider) => {
|
||||
const diff = trackedBalance - providerTracker.latest_balance
|
||||
const diff = providerTracker.latest_balance - trackedBalance
|
||||
if (diff < 0) {
|
||||
this.rugPulled = true
|
||||
if (providerTracker.latest_distruption_at_unix === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue