Skip to content

Commit ba21ca7

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

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

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

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
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)
11+
- [Misc](#misc)
12+
- [Logging](#logging)
913
- [RPC Updates](#rpc-updates)
1014
- [lncli Updates](#lncli-updates)
1115
- [Code Health](#code-health)
1216
- [Breaking Changes](#breaking-changes)
1317
- [Performance Improvements](#performance-improvements)
14-
- [Misc](#misc)
1518
- [Technical and Architectural Updates](#technical-and-architectural-updates)
1619
- [BOLT Spec Updates](#bolt-spec-updates)
1720
- [Testing](#testing)
@@ -109,6 +112,15 @@
109112
# New Features
110113
## Functional Enhancements
111114

115+
* Experimental support for [inbound routing
116+
fees](https://github.com/lightningnetwork/lnd/pull/6703) is added. This allows
117+
node operators to require senders to pay an inbound fee for forwards and
118+
payments. It is recommended to only use negative fees (an inbound "discount")
119+
initially to keep the channels open for senders that do not recognize inbound
120+
fees. In this release, no send support for pathfinding and route building is
121+
added yet. We first want to learn more about the impact that inbound fees have
122+
on the routing economy.
123+
112124
* A new config value,
113125
[sweeper.maxfeerate](https://github.com/lightningnetwork/lnd/pull/7823), is
114126
added so users can specify the max allowed fee rate when sweeping on-chain
@@ -421,6 +433,7 @@ bitcoin peers' feefilter values into account](https://github.com/lightningnetwor
421433
* Elle Mouton
422434
* ErikEk
423435
* Jesse de Wit
436+
* Joost Jager
424437
* Keagan McClelland
425438
* Marcos Fernandez Perez
426439
* 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)