no negative max
This commit is contained in:
parent
b356d804a2
commit
07868a5a14
2 changed files with 4 additions and 2 deletions
|
|
@ -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 = () => {
|
||||
|
|
|
|||
|
|
@ -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<Types.DecodeInvoiceResponse> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue