mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-23 23:55:02 +01:00
Implement fee-reserve
This commit is contained in:
@@ -95,9 +95,12 @@ func (controller *PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if currentBalance < invoice.Amount {
|
||||
minimumBalance := invoice.Amount
|
||||
if controller.svc.Config.FeeReserve {
|
||||
minimumBalance += invoice.CalcFeeLimit()
|
||||
}
|
||||
if currentBalance < minimumBalance {
|
||||
c.Logger().Errorf("User does not have enough balance invoice_id:%v user_id:%v balance:%v amount:%v", invoice.ID, userID, currentBalance, invoice.Amount)
|
||||
|
||||
return c.JSON(http.StatusBadRequest, responses.NotEnoughBalanceError)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user