lncli: use amount based default routing fee

This commit is contained in:
Oliver Gugger committed 2022-02-02 17:29:52 +01:00
1 parent d22f543906
commit d252653624
1 file changed
+5 -2
+5 -2
View File
@@ -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 {