mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-01 10:41:34 +02:00
multi: deprecate dust-treshold config value
Replace ambigious config value "dust-treshold" with a more clear "channel-max-fee-exposure" exposure value. The old value is deprecated and will be removed in the near future.
This commit is contained in:
parent
a040f8fafa
commit
7b2da94750
26
config.go
26
config.go
@ -450,7 +450,9 @@ type Config struct {
|
|||||||
|
|
||||||
GcCanceledInvoicesOnTheFly bool `long:"gc-canceled-invoices-on-the-fly" description:"If true, we'll delete newly canceled invoices on the fly."`
|
GcCanceledInvoicesOnTheFly bool `long:"gc-canceled-invoices-on-the-fly" description:"If true, we'll delete newly canceled invoices on the fly."`
|
||||||
|
|
||||||
MaxFeeExposure uint64 `long:"dust-threshold" description:"Sets the max fee exposure in satoshis for a channel after which HTLC's will be failed."`
|
DustThreshold uint64 `long:"dust-threshold" description:"DEPRECATED: Sets the max fee exposure in satoshis for a channel after which HTLC's will be failed." hidden:"true"`
|
||||||
|
|
||||||
|
MaxFeeExposure uint64 `long:"channel-max-fee-exposure" description:" Limits the maximum fee exposure in satoshis of a channel. This value is enforced for all channels and is independent of the channel initiator."`
|
||||||
|
|
||||||
Fee *lncfg.Fee `group:"fee" namespace:"fee"`
|
Fee *lncfg.Fee `group:"fee" namespace:"fee"`
|
||||||
|
|
||||||
@ -710,7 +712,6 @@ func DefaultConfig() Config {
|
|||||||
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
||||||
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
||||||
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
|
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
|
||||||
MaxFeeExposure: uint64(htlcswitch.DefaultMaxFeeExposure.ToSatoshis()),
|
|
||||||
LogRotator: build.NewRotatingLogWriter(),
|
LogRotator: build.NewRotatingLogWriter(),
|
||||||
DB: lncfg.DefaultDB(),
|
DB: lncfg.DefaultDB(),
|
||||||
Cluster: lncfg.DefaultCluster(),
|
Cluster: lncfg.DefaultCluster(),
|
||||||
@ -1714,6 +1715,27 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
cfg.Pprof.MutexProfile = cfg.MutexProfile
|
cfg.Pprof.MutexProfile = cfg.MutexProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't allow both the old dust-threshold and the new
|
||||||
|
// channel-max-fee-exposure to be set.
|
||||||
|
if cfg.DustThreshold != 0 && cfg.MaxFeeExposure != 0 {
|
||||||
|
return nil, mkErr("cannot set both dust-threshold and " +
|
||||||
|
"channel-max-fee-exposure")
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
// Use the old dust-threshold as the max fee exposure if it is set and
|
||||||
|
// the new option is not.
|
||||||
|
case cfg.DustThreshold != 0:
|
||||||
|
cfg.MaxFeeExposure = cfg.DustThreshold
|
||||||
|
|
||||||
|
// Use the default max fee exposure if the new option is not set and
|
||||||
|
// the old one is not set either.
|
||||||
|
case cfg.MaxFeeExposure == 0:
|
||||||
|
cfg.MaxFeeExposure = uint64(
|
||||||
|
htlcswitch.DefaultMaxFeeExposure.ToSatoshis(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Validate the subconfigs for workers, caches, and the tower client.
|
// Validate the subconfigs for workers, caches, and the tower client.
|
||||||
err = lncfg.Validate(
|
err = lncfg.Validate(
|
||||||
cfg.Workers,
|
cfg.Workers,
|
||||||
|
@ -4516,8 +4516,8 @@ func TestSwitchDustForwarding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sendDustHtlcs is a helper function used to send many dust HTLC's to test the
|
// sendDustHtlcs is a helper function used to send many dust HTLC's to test the
|
||||||
// Switch's dust-threshold logic. It takes a boolean denoting whether or not
|
// Switch's channel-max-fee-exposure logic. It takes a boolean denoting whether
|
||||||
// Alice is the sender.
|
// or not Alice is the sender.
|
||||||
func sendDustHtlcs(t *testing.T, n *threeHopNetwork, alice bool,
|
func sendDustHtlcs(t *testing.T, n *threeHopNetwork, alice bool,
|
||||||
amt lnwire.MilliSatoshi, sid lnwire.ShortChannelID, numHTLCs int) {
|
amt lnwire.MilliSatoshi, sid lnwire.ShortChannelID, numHTLCs int) {
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ func testBidirectionalAsyncPayments(ht *lntest.HarnessTest) {
|
|||||||
args := []string{
|
args := []string{
|
||||||
// Increase the dust threshold to avoid the payments fail due
|
// Increase the dust threshold to avoid the payments fail due
|
||||||
// to threshold limit reached.
|
// to threshold limit reached.
|
||||||
"--dust-threshold=10000000",
|
"--channel-max-fee-exposure=10000000",
|
||||||
|
|
||||||
// Increase the pending commit interval since there are lots of
|
// Increase the pending commit interval since there are lots of
|
||||||
// commitment dances.
|
// commitment dances.
|
||||||
|
@ -316,7 +316,7 @@ func (h *HarnessTest) SetupStandbyNodes() {
|
|||||||
|
|
||||||
lndArgs := []string{
|
lndArgs := []string{
|
||||||
"--default-remote-max-htlcs=483",
|
"--default-remote-max-htlcs=483",
|
||||||
"--dust-threshold=5000000",
|
"--channel-max-fee-exposure=5000000",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the initial seeder nodes within the test network.
|
// Start the initial seeder nodes within the test network.
|
||||||
|
@ -474,10 +474,32 @@
|
|||||||
; propagation
|
; propagation
|
||||||
; max-commit-fee-rate-anchors=10
|
; max-commit-fee-rate-anchors=10
|
||||||
|
|
||||||
; A threshold defining the maximum amount of dust a given channel can have
|
; DEPRECATED: This value will be deprecated please use the new setting
|
||||||
; after which forwarding and sending dust HTLC's to and from the channel will
|
; "channel-max-fee-exposure". This value is equivalent to the new fee exposure
|
||||||
; fail. This amount is expressed in satoshis.
|
; limit but was removed because the name was ambigious.
|
||||||
; dust-threshold=500000
|
; dust-threshold=
|
||||||
|
|
||||||
|
; This value replaces the old 'dust-threshold' setting and defines the maximum
|
||||||
|
; amount of satoshis that a channel pays in fees in case the commitment
|
||||||
|
; transaction is broadcasted. This is enforced in both directions either when
|
||||||
|
; we are the channel intiator hence paying the fees but also applies to the
|
||||||
|
; channel fee if we are NOT the channel initiator. It is
|
||||||
|
; important to note that every HTLC adds fees to the channel state. Non-dust
|
||||||
|
; HTLCs add just a new output onto the commitment transaction whereas dust
|
||||||
|
; HTLCs are completely attributed the commitment fee. So this limit can also
|
||||||
|
; influence adding new HTLCs onto the state. When the limit is reached we won't
|
||||||
|
; allow any new HTLCs onto the channel state (outgoing and incoming). So
|
||||||
|
; choosing a right limit here must be done with caution. Moreover this is a
|
||||||
|
; limit for all channels universally meaning there is no difference made due to
|
||||||
|
; the channel size. So it is recommended to use the default value. However if
|
||||||
|
; you have a very small channel average size you might want to reduce this
|
||||||
|
; value.
|
||||||
|
; WARNING: Setting this value too low might cause force closes because the
|
||||||
|
; lightning protocol has no way to roll back a channel state when your peer
|
||||||
|
; proposes a channel update which exceeds this limit. There are only two options
|
||||||
|
; to resolve this situation, either increasing the limit or one side force
|
||||||
|
; closes the channel.
|
||||||
|
; channel-max-fee-exposure=500000
|
||||||
|
|
||||||
; If true, lnd will abort committing a migration if it would otherwise have been
|
; If true, lnd will abort committing a migration if it would otherwise have been
|
||||||
; successful. This leaves the database unmodified, and still compatible with the
|
; successful. This leaves the database unmodified, and still compatible with the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user