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

@@ -301,6 +301,12 @@ type ChannelLinkConfig struct {
// AuxTrafficShaper is an optional auxiliary traffic shaper that can be
// used to manage the bandwidth of the link.
AuxTrafficShaper fn.Option[AuxTrafficShaper]
// QuiescenceTimeout is 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.
QuiescenceTimeout time.Duration
}
// channelLink is the service which drives a channel's commitment update
@@ -497,7 +503,7 @@ func NewChannelLink(cfg ChannelLinkConfig,
sendMsg: func(s lnwire.Stfu) error {
return cfg.Peer.SendMessage(false, &s)
},
timeoutDuration: defaultQuiescenceTimeout,
timeoutDuration: cfg.QuiescenceTimeout,
onTimeout: func() {
cfg.Peer.Disconnect(ErrQuiescenceTimeout)
},

View File

@@ -47,13 +47,9 @@ var (
// ErrQuiescenceTimeout indicates that the quiescer has been quiesced
// beyond the allotted time.
ErrQuiescenceTimeout = fmt.Errorf(
"quiescence timeout",
)
ErrQuiescenceTimeout = fmt.Errorf("quiescence timeout")
)
const defaultQuiescenceTimeout = 30 * time.Second
type StfuReq = fn.Req[fn.Unit, fn.Result[lntypes.ChannelParty]]
// Quiescer is the public interface of the quiescence mechanism. Callers of the