mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-20 13:53:19 +02:00
lnd: make MailboxDeliveryTimeout
configurable
This commit is contained in:
parent
502a8f3210
commit
e6bebc4fe7
@ -444,6 +444,8 @@ type Config struct {
|
|||||||
|
|
||||||
Sweeper *lncfg.Sweeper `group:"sweeper" namespace:"sweeper"`
|
Sweeper *lncfg.Sweeper `group:"sweeper" namespace:"sweeper"`
|
||||||
|
|
||||||
|
Htlcswitch *lncfg.Htlcswitch `group:"htlcswitch" namespace:"htlcswitch"`
|
||||||
|
|
||||||
// LogWriter is the root logger that all of the daemon's subloggers are
|
// LogWriter is the root logger that all of the daemon's subloggers are
|
||||||
// hooked up to.
|
// hooked up to.
|
||||||
LogWriter *build.RotatingLogWriter
|
LogWriter *build.RotatingLogWriter
|
||||||
@ -462,6 +464,8 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig returns all default values for the Config struct.
|
// DefaultConfig returns all default values for the Config struct.
|
||||||
|
//
|
||||||
|
// nolint:lll
|
||||||
func DefaultConfig() Config {
|
func DefaultConfig() Config {
|
||||||
return Config{
|
return Config{
|
||||||
LndDir: DefaultLndDir,
|
LndDir: DefaultLndDir,
|
||||||
@ -643,6 +647,9 @@ func DefaultConfig() Config {
|
|||||||
Sweeper: &lncfg.Sweeper{
|
Sweeper: &lncfg.Sweeper{
|
||||||
BatchWindowDuration: sweep.DefaultBatchWindowDuration,
|
BatchWindowDuration: sweep.DefaultBatchWindowDuration,
|
||||||
},
|
},
|
||||||
|
Htlcswitch: &lncfg.Htlcswitch{
|
||||||
|
MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1660,6 +1667,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
cfg.RPCMiddleware,
|
cfg.RPCMiddleware,
|
||||||
cfg.RemoteSigner,
|
cfg.RemoteSigner,
|
||||||
cfg.Sweeper,
|
cfg.Sweeper,
|
||||||
|
cfg.Htlcswitch,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
34
lncfg/htlcswitch.go
Normal file
34
lncfg/htlcswitch.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package lncfg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// MaxMailboxDeliveryTimeout specifies the max allowed timeout value.
|
||||||
|
// This value is derived from the itest `async_bidirectional_payments`,
|
||||||
|
// where both side send 483 payments at the same time to stress test
|
||||||
|
// lnd.
|
||||||
|
MaxMailboxDeliveryTimeout = 2 * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
|
// nolint:lll
|
||||||
|
type Htlcswitch struct {
|
||||||
|
MailboxDeliveryTimeout time.Duration `long:"mailboxdeliverytimeout" description:"The timeout value when delivering HTLCs to a channel link. Setting this value too small will result in local payment failures if large number of payments are sent over a short period."`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate checks the values configured for htlcswitch.
|
||||||
|
func (h *Htlcswitch) Validate() error {
|
||||||
|
if h.MailboxDeliveryTimeout <= 0 {
|
||||||
|
return fmt.Errorf("mailboxdeliverytimeout must be positive")
|
||||||
|
}
|
||||||
|
|
||||||
|
if h.MailboxDeliveryTimeout > MaxMailboxDeliveryTimeout {
|
||||||
|
return fmt.Errorf("mailboxdeliverytimeout: %v exceeds "+
|
||||||
|
"maximum: %v", h.MailboxDeliveryTimeout,
|
||||||
|
MaxMailboxDeliveryTimeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -1423,3 +1423,10 @@ litecoin.node=ltcd
|
|||||||
; window to allow more inputs to be added and thereby lower the fee per input.
|
; window to allow more inputs to be added and thereby lower the fee per input.
|
||||||
; sweeper.batchwindowduration=30s
|
; sweeper.batchwindowduration=30s
|
||||||
|
|
||||||
|
[htlcswitch]
|
||||||
|
|
||||||
|
; The timeout value when delivering HTLCs to a channel link. Setting this value
|
||||||
|
; too small will result in local payment failures if large number of payments
|
||||||
|
; are sent over a short period.
|
||||||
|
; htlcswitch.mailboxdeliverytimeout=60s
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
AllowCircularRoute: cfg.AllowCircularRoute,
|
AllowCircularRoute: cfg.AllowCircularRoute,
|
||||||
RejectHTLC: cfg.RejectHTLC,
|
RejectHTLC: cfg.RejectHTLC,
|
||||||
Clock: clock.NewDefaultClock(),
|
Clock: clock.NewDefaultClock(),
|
||||||
MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout,
|
MailboxDeliveryTimeout: cfg.Htlcswitch.MailboxDeliveryTimeout,
|
||||||
DustThreshold: thresholdMSats,
|
DustThreshold: thresholdMSats,
|
||||||
SignAliasUpdate: s.signAliasUpdate,
|
SignAliasUpdate: s.signAliasUpdate,
|
||||||
IsAlias: aliasmgr.IsAlias,
|
IsAlias: aliasmgr.IsAlias,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user