diff --git a/src/services/main/liquidityProvider.ts b/src/services/main/liquidityProvider.ts index b03c30f3..1f8fe2dd 100644 --- a/src/services/main/liquidityProvider.ts +++ b/src/services/main/liquidityProvider.ts @@ -164,7 +164,8 @@ export class LiquidityProvider { const div = 1 + (serviceFeeBps / 10000) const maxWithoutFixed = Math.floor(balance / div) const fee = balance - maxWithoutFixed - return balance - Math.max(fee, serviceFeeFloor) + const m = balance - Math.max(fee, serviceFeeFloor) + return Math.max(m, 0) } GetLatestBalance = () => { diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index 4d498023..3c7812db 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -397,7 +397,8 @@ export default class { const div = 1 + (serviceFeeBps / 10000) const maxWithoutFixed = Math.floor(balance / div) const fee = balance - maxWithoutFixed - const max = balance - Math.max(fee, serviceFeeFloor) + const m = balance - Math.max(fee, serviceFeeFloor) + const max = Math.max(m, 0) return { max, serviceFeeFloor, serviceFeeBps } } async DecodeInvoice(req: Types.DecodeInvoiceRequest): Promise {