Skip to content

Commit a9f1b24

Browse files
committed
itest: multi-hop payment test with negative inbound fee
Ensure that negative fees are backwards compatible.
1 parent 2e369ca commit a9f1b24

File tree

2 files changed

+43
-11
lines changed

2 files changed

+43
-11
lines changed

docs/release-notes/release-notes-0.18.0.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Release Notes
2+
- [Release Notes](#release-notes)
23
- [Bug Fixes](#bug-fixes)
34
- [New Features](#new-features)
45
- [Functional Enhancements](#functional-enhancements)
56
- [RPC Additions](#rpc-additions)
67
- [lncli Additions](#lncli-additions)
78
- [Improvements](#improvements)
89
- [Functional Updates](#functional-updates)
10+
- [Tlv](#tlv)
911
- [RPC Updates](#rpc-updates)
1012
- [lncli Updates](#lncli-updates)
1113
- [Code Health](#code-health)
@@ -48,6 +50,15 @@
4850
# New Features
4951
## Functional Enhancements
5052

53+
* Experimental support for [inbound routing
54+
fees](https://github.com/lightningnetwork/lnd/pull/6703) is added. This allows
55+
node operators to require senders to pay an inbound fee for forwards and
56+
payments. It is recommended to only use negative fees (an inbound "discount")
57+
initially to keep the channels open for senders that do not recognize inbound
58+
fees. In this release, no send support for pathfinding and route building is
59+
added yet. We first want to learn more about the impact that inbound fees have
60+
on the routing economy.
61+
5162
* A new config value,
5263
[sweeper.maxfeerate](https://github.com/lightningnetwork/lnd/pull/7823), is
5364
added so users can specify the max allowed fee rate when sweeping onchain
@@ -175,6 +186,7 @@
175186
* Andras Banki-Horvath
176187
* Carla Kirk-Cohen
177188
* Elle Mouton
189+
* Joost Jager
178190
* Keagan McClelland
179191
* Marcos Fernandez Perez
180192
* Matt Morehouse

itest/lnd_multi-hop-payments_test.go

+31-11
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,29 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
7474
const aliceFeeRatePPM = 100000
7575
updateChannelPolicy(
7676
ht, alice, chanPointAlice, aliceBaseFeeSat*1000,
77-
aliceFeeRatePPM, chainreg.DefaultBitcoinTimeLockDelta,
77+
aliceFeeRatePPM, 0, 0, chainreg.DefaultBitcoinTimeLockDelta,
7878
maxHtlc, carol,
7979
)
8080

81+
// Define a negative inbound fee for Alice, to verify that this is
82+
// backwards compatible with an older sender ignoring the discount.
83+
const (
84+
aliceInboundBaseFeeMsat = -1
85+
aliceInboundFeeRate = -10000
86+
)
87+
88+
updateChannelPolicy(
89+
ht, alice, chanPointDave, 0, 0,
90+
aliceInboundBaseFeeMsat, aliceInboundFeeRate,
91+
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc,
92+
dave,
93+
)
94+
8195
const daveBaseFeeSat = 5
8296
const daveFeeRatePPM = 150000
8397
updateChannelPolicy(
8498
ht, dave, chanPointDave, daveBaseFeeSat*1000, daveFeeRatePPM,
99+
0, 0,
85100
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc, carol,
86101
)
87102

@@ -104,8 +119,9 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
104119
ht.AssertAmountPaid("Alice(local) => Bob(remote)", alice,
105120
chanPointAlice, expectedAmountPaidAtoB, int64(0))
106121

107-
// To forward a payment of 1000 sat, Alice is charging a fee of
108-
// 1 sat + 10% = 101 sat.
122+
// To forward a payment of 1000 sat, Alice is charging a fee of 1 sat +
123+
// 10% = 101 sat. Note that this does not include the inbound fee
124+
// (discount) because there is no sender support yet.
109125
const aliceFeePerPayment = aliceBaseFeeSat +
110126
(paymentAmt * aliceFeeRatePPM / 1_000_000)
111127
const expectedFeeAlice = numPayments * aliceFeePerPayment
@@ -224,15 +240,17 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
224240
// NOTE: only used in current test.
225241
func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode,
226242
chanPoint *lnrpc.ChannelPoint, baseFee int64,
227-
feeRate int64, timeLockDelta uint32,
228-
maxHtlc uint64, listenerNode *node.HarnessNode) {
243+
feeRate int64, inboundBaseFee, inboundFeeRate int32,
244+
timeLockDelta uint32, maxHtlc uint64, listenerNode *node.HarnessNode) {
229245

230246
expectedPolicy := &lnrpc.RoutingPolicy{
231-
FeeBaseMsat: baseFee,
232-
FeeRateMilliMsat: feeRate,
233-
TimeLockDelta: timeLockDelta,
234-
MinHtlc: 1000, // default value
235-
MaxHtlcMsat: maxHtlc,
247+
FeeBaseMsat: baseFee,
248+
FeeRateMilliMsat: feeRate,
249+
TimeLockDelta: timeLockDelta,
250+
MinHtlc: 1000, // default value
251+
MaxHtlcMsat: maxHtlc,
252+
InboundFeeBaseMsat: inboundBaseFee,
253+
InboundFeeRateMilliMsat: inboundFeeRate,
236254
}
237255

238256
updateFeeReq := &lnrpc.PolicyUpdateRequest{
@@ -242,7 +260,9 @@ func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode,
242260
Scope: &lnrpc.PolicyUpdateRequest_ChanPoint{
243261
ChanPoint: chanPoint,
244262
},
245-
MaxHtlcMsat: maxHtlc,
263+
MaxHtlcMsat: maxHtlc,
264+
InboundBaseFeeMsat: inboundBaseFee,
265+
InboundFeeRatePpm: inboundFeeRate,
246266
}
247267

248268
hn.RPC.UpdateChannelPolicy(updateFeeReq)

0 commit comments

Comments
 (0)