Skip to content

Commit 5446478

Browse files
committed
lnwallet: increase legacy fee limit threshold to 1k sats
In this commit, we increase the legacy fee limit threshold (the amount below which we'll allow 100% of funds to go to fees for the non-v2 RPC calls) from 50 sats to 1k sats.
1 parent d4b621b commit 5446478

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

docs/release-notes/release-notes-0.14.2.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ connection from the watch-only node.
3535
* A bug that allowed fees to be up to 100% of the payment amount was fixed by
3636
[introducing a more sane default
3737
value](https://github.com/lightningnetwork/lnd/pull/6226) of 5% routing fees
38-
(except for small amounts <= 50 satoshis where the 100% routing fees are kept
39-
to accommodate for the base fee in channels). To avoid falling back to a
40-
default value, users should always set their own fee limits by using the
41-
`--fee_limit` or `--fee_limit_percent` flags on the `lncli payinvoice`,
42-
`lncli sendpayment` and `lncli queryroutes` commands. Users of the gRPC or
43-
REST API should set the `fee_limit` field on the corresponding calls
44-
(`SendPayment`, `SendPaymentSync`, `QueryRoutes`).
38+
(except for small amounts <= [1k
39+
satoshis](https://github.com/lightningnetwork/lnd/pull/6234) where the 100%
40+
routing fees are kept to accommodate for the base fee in channels). To avoid
41+
falling back to a default value, users should always set their own fee limits
42+
by using the `--fee_limit` or `--fee_limit_percent` flags on the `lncli
43+
payinvoice`, `lncli sendpayment` and `lncli queryroutes` commands. Users of
44+
the gRPC or REST API should set the `fee_limit` field on the corresponding
45+
calls (`SendPayment`, `SendPaymentSync`, `QueryRoutes`).
4546

4647
## Database
4748

lnrpc/lightning.pb.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/lightning.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ message SendRequest {
754754
This value can be represented either as a percentage of the amount being
755755
sent, or as a fixed amount of the maximum fee the user is willing the pay to
756756
send the payment. If not specified, lnd will use a default value of 100%
757-
fees for small amounts (<=50 sat) or 5% fees for larger amounts.
757+
fees for small amounts (<=1k sat) or 5% fees for larger amounts.
758758
*/
759759
FeeLimit fee_limit = 8;
760760

@@ -2573,7 +2573,7 @@ message QueryRoutesRequest {
25732573
This value can be represented either as a percentage of the amount being
25742574
sent, or as a fixed amount of the maximum fee the user is willing the pay to
25752575
send the payment. If not specified, lnd will use a default value of 100%
2576-
fees for small amounts (<=50 sat) or 5% fees for larger amounts.
2576+
fees for small amounts (<=1k sat) or 5% fees for larger amounts.
25772577
*/
25782578
FeeLimit fee_limit = 5;
25792579

lnrpc/lightning.swagger.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6234,7 +6234,7 @@
62346234
},
62356235
"fee_limit": {
62366236
"$ref": "#/definitions/lnrpcFeeLimit",
6237-
"description": "The maximum number of satoshis that will be paid as a fee of the payment.\nThis value can be represented either as a percentage of the amount being\nsent, or as a fixed amount of the maximum fee the user is willing the pay to\nsend the payment. If not specified, lnd will use a default value of 100%\nfees for small amounts (\u003c=50 sat) or 5% fees for larger amounts."
6237+
"description": "The maximum number of satoshis that will be paid as a fee of the payment.\nThis value can be represented either as a percentage of the amount being\nsent, or as a fixed amount of the maximum fee the user is willing the pay to\nsend the payment. If not specified, lnd will use a default value of 100%\nfees for small amounts (\u003c=1k sat) or 5% fees for larger amounts."
62386238
},
62396239
"outgoing_chan_id": {
62406240
"type": "string",

lnwallet/parameters.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ import (
88
"github.com/lightningnetwork/lnd/lnwire"
99
)
1010

11-
const (
11+
var (
1212
// RoutingFee100PercentUpTo is the cut-off amount we allow 100% fees to
1313
// be charged up to.
14-
RoutingFee100PercentUpTo lnwire.MilliSatoshi = 50_000
14+
RoutingFee100PercentUpTo = lnwire.NewMSatFromSatoshis(1_000)
15+
)
16+
17+
const (
1518

1619
// DefaultRoutingFeePercentage is the default off-chain routing fee we
1720
// allow to be charged for a payment over the RoutingFee100PercentUpTo

lnwallet/parameters_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ func TestDefaultRoutingFeeLimitForAmount(t *testing.T) {
2424
expectedLimit: 1,
2525
},
2626
{
27-
amount: 50_000,
28-
expectedLimit: 50_000,
27+
amount: lnwire.NewMSatFromSatoshis(1_000),
28+
expectedLimit: lnwire.NewMSatFromSatoshis(1_000),
2929
},
3030
{
31-
amount: 50_001,
32-
expectedLimit: 2_500,
31+
amount: lnwire.NewMSatFromSatoshis(1_001),
32+
expectedLimit: 50_050,
3333
},
3434
{
3535
amount: 5_000_000_000,
@@ -42,7 +42,7 @@ func TestDefaultRoutingFeeLimitForAmount(t *testing.T) {
4242

4343
t.Run(fmt.Sprintf("%d sats", test.amount), func(t *testing.T) {
4444
feeLimit := DefaultRoutingFeeLimitForAmount(test.amount)
45-
require.Equal(t, test.expectedLimit, feeLimit)
45+
require.Equal(t, int64(test.expectedLimit), int64(feeLimit))
4646
})
4747
}
4848
}

0 commit comments

Comments
 (0)