mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-12 14:42:38 +02:00
htlcswitch+peer: allow the disabling of quiescence
Here we add a flag where we can disable quiescence. This will be used in the case where the feature is not negotiated with our peer.
This commit is contained in:
@@ -283,6 +283,10 @@ type ChannelLinkConfig struct {
|
||||
// invalid.
|
||||
DisallowRouteBlinding bool
|
||||
|
||||
// DisallowQuiescence is a flag that can be used to disable the
|
||||
// quiescence protocol.
|
||||
DisallowQuiescence bool
|
||||
|
||||
// MaxFeeExposure is the threshold in milli-satoshis after which we'll
|
||||
// restrict the flow of HTLCs and fee updates.
|
||||
MaxFeeExposure lnwire.MilliSatoshi
|
||||
@@ -476,14 +480,19 @@ func NewChannelLink(cfg ChannelLinkConfig,
|
||||
cfg.MaxFeeExposure = DefaultMaxFeeExposure
|
||||
}
|
||||
|
||||
quiescerCfg := QuiescerCfg{
|
||||
chanID: lnwire.NewChanIDFromOutPoint(
|
||||
channel.ChannelPoint(),
|
||||
),
|
||||
channelInitiator: channel.Initiator(),
|
||||
sendMsg: func(s lnwire.Stfu) error {
|
||||
return cfg.Peer.SendMessage(false, &s)
|
||||
},
|
||||
var qsm Quiescer
|
||||
if !cfg.DisallowQuiescence {
|
||||
qsm = NewQuiescer(QuiescerCfg{
|
||||
chanID: lnwire.NewChanIDFromOutPoint(
|
||||
channel.ChannelPoint(),
|
||||
),
|
||||
channelInitiator: channel.Initiator(),
|
||||
sendMsg: func(s lnwire.Stfu) error {
|
||||
return cfg.Peer.SendMessage(false, &s)
|
||||
},
|
||||
})
|
||||
} else {
|
||||
qsm = &quiescerNoop{}
|
||||
}
|
||||
|
||||
quiescenceReqs := make(
|
||||
@@ -499,7 +508,7 @@ func NewChannelLink(cfg ChannelLinkConfig,
|
||||
flushHooks: newHookMap(),
|
||||
outgoingCommitHooks: newHookMap(),
|
||||
incomingCommitHooks: newHookMap(),
|
||||
quiescer: NewQuiescer(quiescerCfg),
|
||||
quiescer: qsm,
|
||||
quiescenceReqs: quiescenceReqs,
|
||||
ContextGuard: fn.NewContextGuard(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user