Make the fee limit the sum of base + percentage
This commit is contained in:
parent
e0c19f38a0
commit
6ab7468c25
2 changed files with 3 additions and 7 deletions
|
|
@ -43,10 +43,9 @@ Environment="LN_PORT=10009"
|
||||||
Environment="LN_TLS_FILE=/home/ubuntu/boltcard/tls.cert"
|
Environment="LN_TLS_FILE=/home/ubuntu/boltcard/tls.cert"
|
||||||
Environment="LN_MACAROON_FILE=/home/ubuntu/boltcard/SendPaymentV2.macaroon"
|
Environment="LN_MACAROON_FILE=/home/ubuntu/boltcard/SendPaymentV2.macaroon"
|
||||||
|
|
||||||
# The maximum lightning network fee to be paid in percent of the payment amount.
|
# The maximum lightning network fee to be paid is the base FEE_LIMIT_SAT + the FEE_LIMIT_PERCENT of the amount.
|
||||||
|
Environment="FEE_LIMIT_SAT=5"
|
||||||
Environment="FEE_LIMIT_PERCENT=0.5"
|
Environment="FEE_LIMIT_PERCENT=0.5"
|
||||||
# Acceptable flat fee in sats that can exceed the percentage limit.
|
|
||||||
Environment="FEE_LIMIT_SAT=10"
|
|
||||||
|
|
||||||
# email
|
# email
|
||||||
# Environment="AWS_SES_ID="
|
# Environment="AWS_SES_ID="
|
||||||
|
|
|
||||||
|
|
@ -228,9 +228,6 @@ func pay_invoice(card_payment_id int, invoice string) {
|
||||||
invoice_msats := bolt11.MSatoshi
|
invoice_msats := bolt11.MSatoshi
|
||||||
|
|
||||||
fee_limit_product := int64((fee_limit_percent / 100) * (float64(invoice_msats) / 1000))
|
fee_limit_product := int64((fee_limit_percent / 100) * (float64(invoice_msats) / 1000))
|
||||||
if fee_limit_product > fee_limit_sat {
|
|
||||||
fee_limit_sat = fee_limit_product
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
@ -239,7 +236,7 @@ func pay_invoice(card_payment_id int, invoice string) {
|
||||||
PaymentRequest: invoice,
|
PaymentRequest: invoice,
|
||||||
NoInflightUpdates: true,
|
NoInflightUpdates: true,
|
||||||
TimeoutSeconds: 30,
|
TimeoutSeconds: 30,
|
||||||
FeeLimitSat: fee_limit_sat})
|
FeeLimitSat: fee_limit_sat + fee_limit_product})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{"card_payment_id": card_payment_id}).Warn(err)
|
log.WithFields(log.Fields{"card_payment_id": card_payment_id}).Warn(err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue