mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-26 19:56:29 +02:00
multi: cap anchors feerate at configurable maximum
This commit caps the update fee the initiator will send when the anchors channel type is used. We do not limit anything on the receiver side. 10 sat/vbyte is the current default max fee rate we use. This should be enough to ensure propagation before anchoring down the commitment transaction.
This commit is contained in:
@@ -269,6 +269,10 @@ type ChannelLinkConfig struct {
|
||||
// initiator of the channel.
|
||||
MaxFeeAllocation float64
|
||||
|
||||
// MaxAnchorsCommitFeeRate is the max commitment fee rate we'll use as
|
||||
// the initiator for channels of the anchor type.
|
||||
MaxAnchorsCommitFeeRate chainfee.SatPerKWeight
|
||||
|
||||
// NotifyActiveLink allows the link to tell the ChannelNotifier when a
|
||||
// link is first started.
|
||||
NotifyActiveLink func(wire.OutPoint)
|
||||
@@ -1090,7 +1094,10 @@ func (l *channelLink) htlcManager() {
|
||||
// based on our current set fee rate. We'll cap the new
|
||||
// fee rate to our max fee allocation.
|
||||
commitFee := l.channel.CommitFeeRate()
|
||||
maxFee := l.channel.MaxFeeRate(l.cfg.MaxFeeAllocation)
|
||||
maxFee := l.channel.MaxFeeRate(
|
||||
l.cfg.MaxFeeAllocation,
|
||||
l.cfg.MaxAnchorsCommitFeeRate,
|
||||
)
|
||||
newCommitFee := chainfee.SatPerKWeight(
|
||||
math.Min(float64(netFee), float64(maxFee)),
|
||||
)
|
||||
|
@@ -1185,6 +1185,7 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
|
||||
OutgoingCltvRejectDelta: 3,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(10 * 1000).FeePerKWeight(),
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
|
Reference in New Issue
Block a user