multi: add new config QuiescenceTimeout

This commit makes removes the `defaultQuiescenceTimeout` and makes it
configurable as different nodes have different network environment. In
addition the default timeout has been increased from 30s to 60s.
This commit is contained in:
yyforyongyu
2025-06-27 19:52:56 +08:00
parent 8a03414190
commit 127b0e9f41
7 changed files with 37 additions and 7 deletions

View File

@@ -11,11 +11,21 @@ var (
// where both side send 483 payments at the same time to stress test
// lnd.
MaxMailboxDeliveryTimeout = 2 * time.Minute
// minQuiescenceTimeout specifies the minimal timeout value that can be
// used for `QuiescenceTimeout`.
minQuiescenceTimeout = 30 * time.Second
// DefaultQuiescenceTimeout specifies the default value to be used for
// `QuiescenceTimeout`.
DefaultQuiescenceTimeout = 60 * time.Second
)
//nolint:ll
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."`
QuiescenceTimeout time.Duration `long:"quiescencetimeout" description:"The max duration that the channel can be quiesced. Any dependent protocols (dynamic commitments, splicing, etc.) must finish their operations under this timeout value, otherwise the node will disconnect."`
}
// Validate checks the values configured for htlcswitch.
@@ -30,5 +40,10 @@ func (h *Htlcswitch) Validate() error {
MaxMailboxDeliveryTimeout)
}
if h.QuiescenceTimeout < minQuiescenceTimeout {
return fmt.Errorf("quiescencetimeout: %v below minimal: %v",
h.QuiescenceTimeout, minQuiescenceTimeout)
}
return nil
}