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:
ziggie
2024-10-12 20:29:08 +02:00
parent a040f8fafa
commit 7b2da94750
5 changed files with 54 additions and 10 deletions

View File

@@ -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."`
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"`
@@ -710,7 +712,6 @@ func DefaultConfig() Config {
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
MaxFeeExposure: uint64(htlcswitch.DefaultMaxFeeExposure.ToSatoshis()),
LogRotator: build.NewRotatingLogWriter(),
DB: lncfg.DefaultDB(),
Cluster: lncfg.DefaultCluster(),
@@ -1714,6 +1715,27 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
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.
err = lncfg.Validate(
cfg.Workers,