mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-06 18:36:57 +02:00
Merge pull request #5206 from carlaKC/4987-heightexpirywatcher
invoices: add height based expiry watcher
This commit is contained in:
17
config.go
17
config.go
@@ -347,6 +347,8 @@ type Config struct {
|
||||
|
||||
GcCanceledInvoicesOnTheFly bool `long:"gc-canceled-invoices-on-the-fly" description:"If true, we'll delete newly canceled invoices on the fly."`
|
||||
|
||||
Invoices *lncfg.Invoices `group:"invoices" namespace:"invoices"`
|
||||
|
||||
Routing *lncfg.Routing `group:"routing" namespace:"routing"`
|
||||
|
||||
Gossip *lncfg.Gossip `group:"gossip" namespace:"gossip"`
|
||||
@@ -532,6 +534,9 @@ func DefaultConfig() Config {
|
||||
MaxChannelUpdateBurst: discovery.DefaultMaxChannelUpdateBurst,
|
||||
ChannelUpdateInterval: discovery.DefaultChannelUpdateInterval,
|
||||
},
|
||||
Invoices: &lncfg.Invoices{
|
||||
HoldExpiryDelta: lncfg.DefaultHoldInvoiceExpiryDelta,
|
||||
},
|
||||
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
||||
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
||||
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
|
||||
@@ -1389,6 +1394,18 @@ func ValidateConfig(cfg Config, usageMessage string,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Log a warning if our expiry delta is not greater than our incoming
|
||||
// broadcast delta. We do not fail here because this value may be set
|
||||
// to zero to intentionally keep lnd's behavior unchanged from when we
|
||||
// didn't auto-cancel these invoices.
|
||||
if cfg.Invoices.HoldExpiryDelta <= lncfg.DefaultIncomingBroadcastDelta {
|
||||
ltndLog.Warnf("Invoice hold expiry delta: %v <= incoming "+
|
||||
"delta: %v, accepted hold invoices will force close "+
|
||||
"channels if they are not canceled manually",
|
||||
cfg.Invoices.HoldExpiryDelta,
|
||||
lncfg.DefaultIncomingBroadcastDelta)
|
||||
}
|
||||
|
||||
// Validate the subconfigs for workers, caches, and the tower client.
|
||||
err = lncfg.Validate(
|
||||
cfg.Workers,
|
||||
|
Reference in New Issue
Block a user