From d252653624305745a5278c0e5c78e452c83f2f76 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 2 Feb 2022 14:24:54 +0100 Subject: [PATCH] lncli: use amount based default routing fee --- cmd/lncli/cmd_payments.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/lncli/cmd_payments.go b/cmd/lncli/cmd_payments.go index 057d923dc..c6c6bf940 100644 --- a/cmd/lncli/cmd_payments.go +++ b/cmd/lncli/cmd_payments.go @@ -22,6 +22,7 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/record" "github.com/lightningnetwork/lnd/routing/route" @@ -217,8 +218,10 @@ func retrieveFeeLimit(ctx *cli.Context, amt int64) (int64, error) { return feeLimitRoundedUp, nil } - // If no fee limit is set, use the payment amount as a limit (100%). - return amt, nil + // If no fee limit is set, use a default value based on the amount. + amtMsat := lnwire.NewMSatFromSatoshis(btcutil.Amount(amt)) + limitMsat := lnwallet.DefaultRoutingFeeLimitForAmount(amtMsat) + return int64(limitMsat.ToSatoshis()), nil } func confirmPayReq(resp *lnrpc.PayReq, amt, feeLimit int64) error {