mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 15:40:59 +02:00
itest: multi-hop payment test with negative inbound fee
Ensure that negative fees are backwards compatible.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# Release Notes
|
# Release Notes
|
||||||
|
- [Release Notes](#release-notes)
|
||||||
- [Bug Fixes](#bug-fixes)
|
- [Bug Fixes](#bug-fixes)
|
||||||
- [New Features](#new-features)
|
- [New Features](#new-features)
|
||||||
- [Functional Enhancements](#functional-enhancements)
|
- [Functional Enhancements](#functional-enhancements)
|
||||||
@@ -6,12 +7,14 @@
|
|||||||
- [lncli Additions](#lncli-additions)
|
- [lncli Additions](#lncli-additions)
|
||||||
- [Improvements](#improvements)
|
- [Improvements](#improvements)
|
||||||
- [Functional Updates](#functional-updates)
|
- [Functional Updates](#functional-updates)
|
||||||
|
- [Tlv](#tlv)
|
||||||
|
- [Misc](#misc)
|
||||||
|
- [Logging](#logging)
|
||||||
- [RPC Updates](#rpc-updates)
|
- [RPC Updates](#rpc-updates)
|
||||||
- [lncli Updates](#lncli-updates)
|
- [lncli Updates](#lncli-updates)
|
||||||
- [Code Health](#code-health)
|
- [Code Health](#code-health)
|
||||||
- [Breaking Changes](#breaking-changes)
|
- [Breaking Changes](#breaking-changes)
|
||||||
- [Performance Improvements](#performance-improvements)
|
- [Performance Improvements](#performance-improvements)
|
||||||
- [Misc](#misc)
|
|
||||||
- [Technical and Architectural Updates](#technical-and-architectural-updates)
|
- [Technical and Architectural Updates](#technical-and-architectural-updates)
|
||||||
- [BOLT Spec Updates](#bolt-spec-updates)
|
- [BOLT Spec Updates](#bolt-spec-updates)
|
||||||
- [Testing](#testing)
|
- [Testing](#testing)
|
||||||
@@ -109,6 +112,15 @@
|
|||||||
# New Features
|
# New Features
|
||||||
## Functional Enhancements
|
## Functional Enhancements
|
||||||
|
|
||||||
|
* Experimental support for [inbound routing
|
||||||
|
fees](https://github.com/lightningnetwork/lnd/pull/6703) is added. This allows
|
||||||
|
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. In this release, no send support for pathfinding and route building is
|
||||||
|
added yet. We first want to learn more about the impact that inbound fees have
|
||||||
|
on the routing economy.
|
||||||
|
|
||||||
* A new config value,
|
* A new config value,
|
||||||
[sweeper.maxfeerate](https://github.com/lightningnetwork/lnd/pull/7823), is
|
[sweeper.maxfeerate](https://github.com/lightningnetwork/lnd/pull/7823), is
|
||||||
added so users can specify the max allowed fee rate when sweeping on-chain
|
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
|
|||||||
* Elle Mouton
|
* Elle Mouton
|
||||||
* ErikEk
|
* ErikEk
|
||||||
* Jesse de Wit
|
* Jesse de Wit
|
||||||
|
* Joost Jager
|
||||||
* Keagan McClelland
|
* Keagan McClelland
|
||||||
* Marcos Fernandez Perez
|
* Marcos Fernandez Perez
|
||||||
* Matt Morehouse
|
* Matt Morehouse
|
||||||
|
@@ -74,14 +74,29 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
|
|||||||
const aliceFeeRatePPM = 100000
|
const aliceFeeRatePPM = 100000
|
||||||
updateChannelPolicy(
|
updateChannelPolicy(
|
||||||
ht, alice, chanPointAlice, aliceBaseFeeSat*1000,
|
ht, alice, chanPointAlice, aliceBaseFeeSat*1000,
|
||||||
aliceFeeRatePPM, chainreg.DefaultBitcoinTimeLockDelta,
|
aliceFeeRatePPM, 0, 0, chainreg.DefaultBitcoinTimeLockDelta,
|
||||||
maxHtlc, carol,
|
maxHtlc, carol,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Define a negative inbound fee for Alice, to verify that this is
|
||||||
|
// backwards compatible with an older sender ignoring the discount.
|
||||||
|
const (
|
||||||
|
aliceInboundBaseFeeMsat = -1
|
||||||
|
aliceInboundFeeRate = -10000
|
||||||
|
)
|
||||||
|
|
||||||
|
updateChannelPolicy(
|
||||||
|
ht, alice, chanPointDave, 0, 0,
|
||||||
|
aliceInboundBaseFeeMsat, aliceInboundFeeRate,
|
||||||
|
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc,
|
||||||
|
dave,
|
||||||
|
)
|
||||||
|
|
||||||
const daveBaseFeeSat = 5
|
const daveBaseFeeSat = 5
|
||||||
const daveFeeRatePPM = 150000
|
const daveFeeRatePPM = 150000
|
||||||
updateChannelPolicy(
|
updateChannelPolicy(
|
||||||
ht, dave, chanPointDave, daveBaseFeeSat*1000, daveFeeRatePPM,
|
ht, dave, chanPointDave, daveBaseFeeSat*1000, daveFeeRatePPM,
|
||||||
|
0, 0,
|
||||||
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc, carol,
|
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc, carol,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -104,8 +119,9 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
|
|||||||
ht.AssertAmountPaid("Alice(local) => Bob(remote)", alice,
|
ht.AssertAmountPaid("Alice(local) => Bob(remote)", alice,
|
||||||
chanPointAlice, expectedAmountPaidAtoB, int64(0))
|
chanPointAlice, expectedAmountPaidAtoB, int64(0))
|
||||||
|
|
||||||
// To forward a payment of 1000 sat, Alice is charging a fee of
|
// To forward a payment of 1000 sat, Alice is charging a fee of 1 sat +
|
||||||
// 1 sat + 10% = 101 sat.
|
// 10% = 101 sat. Note that this does not include the inbound fee
|
||||||
|
// (discount) because there is no sender support yet.
|
||||||
const aliceFeePerPayment = aliceBaseFeeSat +
|
const aliceFeePerPayment = aliceBaseFeeSat +
|
||||||
(paymentAmt * aliceFeeRatePPM / 1_000_000)
|
(paymentAmt * aliceFeeRatePPM / 1_000_000)
|
||||||
const expectedFeeAlice = numPayments * aliceFeePerPayment
|
const expectedFeeAlice = numPayments * aliceFeePerPayment
|
||||||
@@ -224,15 +240,17 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
|
|||||||
// NOTE: only used in current test.
|
// NOTE: only used in current test.
|
||||||
func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
||||||
chanPoint *lnrpc.ChannelPoint, baseFee int64,
|
chanPoint *lnrpc.ChannelPoint, baseFee int64,
|
||||||
feeRate int64, timeLockDelta uint32,
|
feeRate int64, inboundBaseFee, inboundFeeRate int32,
|
||||||
maxHtlc uint64, listenerNode *node.HarnessNode) {
|
timeLockDelta uint32, maxHtlc uint64, listenerNode *node.HarnessNode) {
|
||||||
|
|
||||||
expectedPolicy := &lnrpc.RoutingPolicy{
|
expectedPolicy := &lnrpc.RoutingPolicy{
|
||||||
FeeBaseMsat: baseFee,
|
FeeBaseMsat: baseFee,
|
||||||
FeeRateMilliMsat: feeRate,
|
FeeRateMilliMsat: feeRate,
|
||||||
TimeLockDelta: timeLockDelta,
|
TimeLockDelta: timeLockDelta,
|
||||||
MinHtlc: 1000, // default value
|
MinHtlc: 1000, // default value
|
||||||
MaxHtlcMsat: maxHtlc,
|
MaxHtlcMsat: maxHtlc,
|
||||||
|
InboundFeeBaseMsat: inboundBaseFee,
|
||||||
|
InboundFeeRateMilliMsat: inboundFeeRate,
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeeReq := &lnrpc.PolicyUpdateRequest{
|
updateFeeReq := &lnrpc.PolicyUpdateRequest{
|
||||||
@@ -242,7 +260,9 @@ func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
|||||||
Scope: &lnrpc.PolicyUpdateRequest_ChanPoint{
|
Scope: &lnrpc.PolicyUpdateRequest_ChanPoint{
|
||||||
ChanPoint: chanPoint,
|
ChanPoint: chanPoint,
|
||||||
},
|
},
|
||||||
MaxHtlcMsat: maxHtlc,
|
MaxHtlcMsat: maxHtlc,
|
||||||
|
InboundBaseFeeMsat: inboundBaseFee,
|
||||||
|
InboundFeeRatePpm: inboundFeeRate,
|
||||||
}
|
}
|
||||||
|
|
||||||
hn.RPC.UpdateChannelPolicy(updateFeeReq)
|
hn.RPC.UpdateChannelPolicy(updateFeeReq)
|
||||||
|
Reference in New Issue
Block a user