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