diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 10bb55a956..5ffca5c739 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -2376,14 +2376,14 @@ func updateChannelPolicy(ctx *cli.Context) error { inboundBaseFeeMsat := ctx.Int64("inbound_base_fee_msat") if inboundBaseFeeMsat < math.MinInt32 || - inboundBaseFeeMsat > 0 { + inboundBaseFeeMsat > math.MaxInt32 { return errors.New("inbound_base_fee_msat out of range") } inboundFeeRatePpm := ctx.Int64("inbound_fee_rate_ppm") if inboundFeeRatePpm < math.MinInt32 || - inboundFeeRatePpm > 0 { + inboundFeeRatePpm > math.MaxInt32 { return errors.New("inbound_fee_rate_ppm out of range") } diff --git a/config.go b/config.go index 3849950879..53f59904a4 100644 --- a/config.go +++ b/config.go @@ -411,6 +411,8 @@ type Config struct { RejectHTLC bool `long:"rejecthtlc" description:"If true, lnd will not forward any HTLCs that are meant as onward payments. This option will still allow lnd to send HTLCs and receive HTLCs but lnd won't be used as a hop."` + AcceptPositiveInboundFees bool `long:"accept-positive-inbound-fees" description:"If true, lnd will also allow setting positive inbound fees. By default, lnd only allows to set negative inbound fees (an inbound \"discount\") to remain backwards compatible with senders whose implementations do not yet support inbound fees."` + // RequireInterceptor determines whether the HTLC interceptor is // registered regardless of whether the RPC is called or not. RequireInterceptor bool `long:"requireinterceptor" description:"Whether to always intercept HTLCs, even if no stream is attached"` diff --git a/docs/release-notes/release-notes-0.18.0.md b/docs/release-notes/release-notes-0.18.0.md index d10f62163c..ab71817372 100644 --- a/docs/release-notes/release-notes-0.18.0.md +++ b/docs/release-notes/release-notes-0.18.0.md @@ -127,9 +127,14 @@ node operators to require senders to pay an inbound fee for forwards and payments. It is recommended to only use negative fees (an inbound "discount") initially to keep the channels open for senders that do not recognize inbound - fees. [Send support](https://github.com/lightningnetwork/lnd/pull/6934) is + fees. + + [Send support](https://github.com/lightningnetwork/lnd/pull/6934) is implemented as well. + [Positive inbound fees](https://github.com/lightningnetwork/lnd/pull/8627) + can be enabled with the option `accept-positive-inbound-fees`. + * A new config value, [sweeper.maxfeerate](https://github.com/lightningnetwork/lnd/pull/7823), is added so users can specify the max allowed fee rate when sweeping on-chain @@ -467,6 +472,7 @@ bitcoin peers' feefilter values into account](https://github.com/lightningnetwor * Carla Kirk-Cohen * Elle Mouton * ErikEk +* Feelancer21 * Jesse de Wit * Joost Jager * Keagan McClelland diff --git a/rpcserver.go b/rpcserver.go index 517bca41e4..2c5cca5b0f 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -7109,6 +7109,20 @@ func (r *rpcServer) UpdateChannelPolicy(ctx context.Context, MaxTimeLockDelta) } + // By default, positive inbound fees are rejected. + if !r.cfg.AcceptPositiveInboundFees { + if req.InboundBaseFeeMsat > 0 { + return nil, fmt.Errorf("positive values for inbound "+ + "base fee msat are not supported: %v", + req.InboundBaseFeeMsat) + } + if req.InboundFeeRatePpm > 0 { + return nil, fmt.Errorf("positive values for inbound "+ + "fee rate ppm are not supported: %v", + req.InboundFeeRatePpm) + } + } + baseFeeMsat := lnwire.MilliSatoshi(req.BaseFeeMsat) feeSchema := routing.FeeSchema{ BaseFee: baseFeeMsat, diff --git a/sample-lnd.conf b/sample-lnd.conf index 08a79bde5b..0499ac7cb1 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -438,6 +438,13 @@ ; If true, all HTLCs will be held until they are handled by an interceptor ; requireinterceptor=false +; If true, lnd will also allow setting positive inbound fees. By default, lnd +; only allows to set negative inbound fees (an inbound "discount") to remain +; backwards compatible with senders whose implementations do not yet support +; inbound fees. Therefore, you should ONLY set this setting if you know what you +; are doing. [experimental] +; accept-positive-inbound-fees=false + ; If true, will apply a randomized staggering between 0s and 30s when ; reconnecting to persistent peers on startup. The first 10 reconnections will be ; attempted instantly, regardless of the flag's value