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:
7 files changed
+49
-9
No files matched your search
@@ -84,6 +84,10 @@ var defaultSetDesc = setDesc{
|
|||||||
SetNodeAnn: {}, // N
|
SetNodeAnn: {}, // N
|
||||||
SetInvoice: {}, // 9
|
SetInvoice: {}, // 9
|
||||||
},
|
},
|
||||||
|
lnwire.QuiescenceOptional: {
|
||||||
|
SetInit: {}, // I
|
||||||
|
SetNodeAnn: {}, // N
|
||||||
|
},
|
||||||
lnwire.ShutdownAnySegwitOptional: {
|
lnwire.ShutdownAnySegwitOptional: {
|
||||||
SetInit: {}, // I
|
SetInit: {}, // I
|
||||||
SetNodeAnn: {}, // N
|
SetNodeAnn: {}, // N
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ type Config struct {
|
|||||||
// NoRouteBlinding unsets route blinding feature bits.
|
// NoRouteBlinding unsets route blinding feature bits.
|
||||||
NoRouteBlinding bool
|
NoRouteBlinding bool
|
||||||
|
|
||||||
|
// NoQuiescence unsets quiescence feature bits.
|
||||||
|
NoQuiescence bool
|
||||||
|
|
||||||
// NoTaprootOverlay unsets the taproot overlay channel feature bits.
|
// NoTaprootOverlay unsets the taproot overlay channel feature bits.
|
||||||
NoTaprootOverlay bool
|
NoTaprootOverlay bool
|
||||||
|
|
||||||
@@ -199,6 +202,9 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
|
|||||||
raw.Unset(lnwire.Bolt11BlindedPathsOptional)
|
raw.Unset(lnwire.Bolt11BlindedPathsOptional)
|
||||||
raw.Unset(lnwire.Bolt11BlindedPathsRequired)
|
raw.Unset(lnwire.Bolt11BlindedPathsRequired)
|
||||||
}
|
}
|
||||||
|
if cfg.NoQuiescence {
|
||||||
|
raw.Unset(lnwire.QuiescenceOptional)
|
||||||
|
}
|
||||||
if cfg.NoTaprootOverlay {
|
if cfg.NoTaprootOverlay {
|
||||||
raw.Unset(lnwire.SimpleTaprootOverlayChansOptional)
|
raw.Unset(lnwire.SimpleTaprootOverlayChansOptional)
|
||||||
raw.Unset(lnwire.SimpleTaprootOverlayChansRequired)
|
raw.Unset(lnwire.SimpleTaprootOverlayChansRequired)
|
||||||
|
|||||||
+18
-9
@@ -283,6 +283,10 @@ type ChannelLinkConfig struct {
|
|||||||
// invalid.
|
// invalid.
|
||||||
DisallowRouteBlinding bool
|
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
|
// MaxFeeExposure is the threshold in milli-satoshis after which we'll
|
||||||
// restrict the flow of HTLCs and fee updates.
|
// restrict the flow of HTLCs and fee updates.
|
||||||
MaxFeeExposure lnwire.MilliSatoshi
|
MaxFeeExposure lnwire.MilliSatoshi
|
||||||
@@ -476,14 +480,19 @@ func NewChannelLink(cfg ChannelLinkConfig,
|
|||||||
cfg.MaxFeeExposure = DefaultMaxFeeExposure
|
cfg.MaxFeeExposure = DefaultMaxFeeExposure
|
||||||
}
|
}
|
||||||
|
|
||||||
quiescerCfg := QuiescerCfg{
|
var qsm Quiescer
|
||||||
chanID: lnwire.NewChanIDFromOutPoint(
|
if !cfg.DisallowQuiescence {
|
||||||
channel.ChannelPoint(),
|
qsm = NewQuiescer(QuiescerCfg{
|
||||||
),
|
chanID: lnwire.NewChanIDFromOutPoint(
|
||||||
channelInitiator: channel.Initiator(),
|
channel.ChannelPoint(),
|
||||||
sendMsg: func(s lnwire.Stfu) error {
|
),
|
||||||
return cfg.Peer.SendMessage(false, &s)
|
channelInitiator: channel.Initiator(),
|
||||||
},
|
sendMsg: func(s lnwire.Stfu) error {
|
||||||
|
return cfg.Peer.SendMessage(false, &s)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
qsm = &quiescerNoop{}
|
||||||
}
|
}
|
||||||
|
|
||||||
quiescenceReqs := make(
|
quiescenceReqs := make(
|
||||||
@@ -499,7 +508,7 @@ func NewChannelLink(cfg ChannelLinkConfig,
|
|||||||
flushHooks: newHookMap(),
|
flushHooks: newHookMap(),
|
||||||
outgoingCommitHooks: newHookMap(),
|
outgoingCommitHooks: newHookMap(),
|
||||||
incomingCommitHooks: newHookMap(),
|
incomingCommitHooks: newHookMap(),
|
||||||
quiescer: NewQuiescer(quiescerCfg),
|
quiescer: qsm,
|
||||||
quiescenceReqs: quiescenceReqs,
|
quiescenceReqs: quiescenceReqs,
|
||||||
ContextGuard: fn.NewContextGuard(),
|
ContextGuard: fn.NewContextGuard(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,11 @@ func (l *ProtocolOptions) NoExperimentalEndorsement() bool {
|
|||||||
return l.NoExperimentalEndorsementOption
|
return l.NoExperimentalEndorsementOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoQuiescence returns true if quiescence is disabled.
|
||||||
|
func (l *ProtocolOptions) NoQuiescence() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// CustomMessageOverrides returns the set of protocol messages that we override
|
// CustomMessageOverrides returns the set of protocol messages that we override
|
||||||
// to allow custom handling.
|
// to allow custom handling.
|
||||||
func (p ProtocolOptions) CustomMessageOverrides() []uint16 {
|
func (p ProtocolOptions) CustomMessageOverrides() []uint16 {
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ type ProtocolOptions struct {
|
|||||||
// NoExperimentalEndorsementOption disables experimental endorsement.
|
// NoExperimentalEndorsementOption disables experimental endorsement.
|
||||||
NoExperimentalEndorsementOption bool `long:"no-experimental-endorsement" description:"do not forward experimental endorsement signals"`
|
NoExperimentalEndorsementOption bool `long:"no-experimental-endorsement" description:"do not forward experimental endorsement signals"`
|
||||||
|
|
||||||
|
// NoQuiescenceOption disables quiescence for all channels.
|
||||||
|
NoQuiescenceOption bool `long:"no-quiescence" description:"do not allow or advertise quiescence for any channel"`
|
||||||
|
|
||||||
// CustomMessage allows the custom message APIs to handle messages with
|
// CustomMessage allows the custom message APIs to handle messages with
|
||||||
// the provided protocol numbers, which fall outside the custom message
|
// the provided protocol numbers, which fall outside the custom message
|
||||||
// number range.
|
// number range.
|
||||||
@@ -136,6 +139,11 @@ func (l *ProtocolOptions) NoExperimentalEndorsement() bool {
|
|||||||
return l.NoExperimentalEndorsementOption
|
return l.NoExperimentalEndorsementOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoQuiescence returns true if quiescence is disabled.
|
||||||
|
func (l *ProtocolOptions) NoQuiescence() bool {
|
||||||
|
return l.NoQuiescenceOption
|
||||||
|
}
|
||||||
|
|
||||||
// CustomMessageOverrides returns the set of protocol messages that we override
|
// CustomMessageOverrides returns the set of protocol messages that we override
|
||||||
// to allow custom handling.
|
// to allow custom handling.
|
||||||
func (l ProtocolOptions) CustomMessageOverrides() []uint16 {
|
func (l ProtocolOptions) CustomMessageOverrides() []uint16 {
|
||||||
|
|||||||
@@ -411,6 +411,10 @@ type Config struct {
|
|||||||
// invalid.
|
// invalid.
|
||||||
DisallowRouteBlinding bool
|
DisallowRouteBlinding bool
|
||||||
|
|
||||||
|
// DisallowQuiescence is a flag that indicates whether the Brontide
|
||||||
|
// should have the quiescence feature disabled.
|
||||||
|
DisallowQuiescence bool
|
||||||
|
|
||||||
// MaxFeeExposure limits the number of outstanding fees in a channel.
|
// MaxFeeExposure limits the number of outstanding fees in a channel.
|
||||||
// This value will be passed to created links.
|
// This value will be passed to created links.
|
||||||
MaxFeeExposure lnwire.MilliSatoshi
|
MaxFeeExposure lnwire.MilliSatoshi
|
||||||
@@ -1324,6 +1328,8 @@ func (p *Brontide) addLink(chanPoint *wire.OutPoint,
|
|||||||
DisallowRouteBlinding: p.cfg.DisallowRouteBlinding,
|
DisallowRouteBlinding: p.cfg.DisallowRouteBlinding,
|
||||||
MaxFeeExposure: p.cfg.MaxFeeExposure,
|
MaxFeeExposure: p.cfg.MaxFeeExposure,
|
||||||
ShouldFwdExpEndorsement: p.cfg.ShouldFwdExpEndorsement,
|
ShouldFwdExpEndorsement: p.cfg.ShouldFwdExpEndorsement,
|
||||||
|
DisallowQuiescence: p.cfg.DisallowQuiescence ||
|
||||||
|
!p.remoteFeatures.HasFeature(lnwire.QuiescenceOptional),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before adding our new link, purge the switch of any pending or live
|
// Before adding our new link, purge the switch of any pending or live
|
||||||
|
|||||||
@@ -587,6 +587,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
NoTaprootOverlay: !cfg.ProtocolOptions.TaprootOverlayChans,
|
NoTaprootOverlay: !cfg.ProtocolOptions.TaprootOverlayChans,
|
||||||
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
||||||
NoExperimentalEndorsement: cfg.ProtocolOptions.NoExperimentalEndorsement(),
|
NoExperimentalEndorsement: cfg.ProtocolOptions.NoExperimentalEndorsement(),
|
||||||
|
NoQuiescence: cfg.ProtocolOptions.NoQuiescence(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -4214,6 +4215,7 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
|
|||||||
RequestAlias: s.aliasMgr.RequestAlias,
|
RequestAlias: s.aliasMgr.RequestAlias,
|
||||||
AddLocalAlias: s.aliasMgr.AddLocalAlias,
|
AddLocalAlias: s.aliasMgr.AddLocalAlias,
|
||||||
DisallowRouteBlinding: s.cfg.ProtocolOptions.NoRouteBlinding(),
|
DisallowRouteBlinding: s.cfg.ProtocolOptions.NoRouteBlinding(),
|
||||||
|
DisallowQuiescence: s.cfg.ProtocolOptions.NoQuiescence(),
|
||||||
MaxFeeExposure: thresholdMSats,
|
MaxFeeExposure: thresholdMSats,
|
||||||
Quit: s.quit,
|
Quit: s.quit,
|
||||||
AuxLeafStore: s.implCfg.AuxLeafStore,
|
AuxLeafStore: s.implCfg.AuxLeafStore,
|
||||||
|
|||||||
Reference in new issue
Block a user