mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-23 03:15:27 +02:00
multi: add experimental endorsement feature bit and disable option
This commit is contained in:
@@ -96,4 +96,7 @@ var defaultSetDesc = setDesc{
|
|||||||
SetInit: {}, // I
|
SetInit: {}, // I
|
||||||
SetNodeAnn: {}, // N
|
SetNodeAnn: {}, // N
|
||||||
},
|
},
|
||||||
|
lnwire.ExperimentalEndorsementOptional: {
|
||||||
|
SetNodeAnn: {}, // N
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@@ -66,6 +66,10 @@ type Config struct {
|
|||||||
// NoTaprootOverlay unsets the taproot overlay channel feature bits.
|
// NoTaprootOverlay unsets the taproot overlay channel feature bits.
|
||||||
NoTaprootOverlay bool
|
NoTaprootOverlay bool
|
||||||
|
|
||||||
|
// NoExperimentalEndorsement unsets any bits that signal support for
|
||||||
|
// forwarding experimental endorsement.
|
||||||
|
NoExperimentalEndorsement bool
|
||||||
|
|
||||||
// CustomFeatures is a set of custom features to advertise in each
|
// CustomFeatures is a set of custom features to advertise in each
|
||||||
// set.
|
// set.
|
||||||
CustomFeatures map[Set][]lnwire.FeatureBit
|
CustomFeatures map[Set][]lnwire.FeatureBit
|
||||||
@@ -199,6 +203,12 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
|
|||||||
raw.Unset(lnwire.SimpleTaprootOverlayChansOptional)
|
raw.Unset(lnwire.SimpleTaprootOverlayChansOptional)
|
||||||
raw.Unset(lnwire.SimpleTaprootOverlayChansRequired)
|
raw.Unset(lnwire.SimpleTaprootOverlayChansRequired)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.NoExperimentalEndorsement {
|
||||||
|
raw.Unset(lnwire.ExperimentalEndorsementOptional)
|
||||||
|
raw.Unset(lnwire.ExperimentalEndorsementRequired)
|
||||||
|
}
|
||||||
|
|
||||||
for _, custom := range cfg.CustomFeatures[set] {
|
for _, custom := range cfg.CustomFeatures[set] {
|
||||||
if custom > set.Maximum() {
|
if custom > set.Maximum() {
|
||||||
return nil, fmt.Errorf("feature bit: %v "+
|
return nil, fmt.Errorf("feature bit: %v "+
|
||||||
|
@@ -67,6 +67,9 @@ type ProtocolOptions struct {
|
|||||||
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
||||||
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
||||||
|
|
||||||
|
// NoExperimentalEndorsementOption disables experimental endorsement.
|
||||||
|
NoExperimentalEndorsementOption bool `long:"no-experimental-endorsement" description:"do not forward experimental endorsement signals"`
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -132,6 +135,12 @@ func (l *ProtocolOptions) NoRouteBlinding() bool {
|
|||||||
return l.NoRouteBlindingOption
|
return l.NoRouteBlindingOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoExperimentalEndorsement returns true if experimental endorsement should
|
||||||
|
// be disabled.
|
||||||
|
func (l *ProtocolOptions) NoExperimentalEndorsement() bool {
|
||||||
|
return l.NoExperimentalEndorsementOption
|
||||||
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
|
@@ -70,6 +70,9 @@ type ProtocolOptions struct {
|
|||||||
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
||||||
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
||||||
|
|
||||||
|
// NoExperimentalEndorsementOption disables experimental endorsement.
|
||||||
|
NoExperimentalEndorsementOption bool `long:"no-experimental-endorsement" description:"do not forward experimental endorsement signals"`
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -127,6 +130,12 @@ func (l *ProtocolOptions) NoRouteBlinding() bool {
|
|||||||
return l.NoRouteBlindingOption
|
return l.NoRouteBlindingOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoExperimentalEndorsement returns true if experimental endorsement should
|
||||||
|
// be disabled.
|
||||||
|
func (l *ProtocolOptions) NoExperimentalEndorsement() bool {
|
||||||
|
return l.NoExperimentalEndorsementOption
|
||||||
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
|
@@ -263,6 +263,14 @@ const (
|
|||||||
// being finalized.
|
// being finalized.
|
||||||
SimpleTaprootChannelsOptionalStaging = 181
|
SimpleTaprootChannelsOptionalStaging = 181
|
||||||
|
|
||||||
|
// ExperimentalEndorsementRequired is a required feature bit that
|
||||||
|
// indicates that the node will relay experimental endorsement signals.
|
||||||
|
ExperimentalEndorsementRequired FeatureBit = 260
|
||||||
|
|
||||||
|
// ExperimentalEndorsementOptional is an optional feature bit that
|
||||||
|
// indicates that the node will relay experimental endorsement signals.
|
||||||
|
ExperimentalEndorsementOptional FeatureBit = 261
|
||||||
|
|
||||||
// Bolt11BlindedPathsRequired is a required feature bit that indicates
|
// Bolt11BlindedPathsRequired is a required feature bit that indicates
|
||||||
// that the node is able to understand the blinded path tagged field in
|
// that the node is able to understand the blinded path tagged field in
|
||||||
// a BOLT 11 invoice.
|
// a BOLT 11 invoice.
|
||||||
@@ -349,6 +357,8 @@ var Features = map[FeatureBit]string{
|
|||||||
SimpleTaprootChannelsOptionalStaging: "simple-taproot-chans-x",
|
SimpleTaprootChannelsOptionalStaging: "simple-taproot-chans-x",
|
||||||
SimpleTaprootOverlayChansOptional: "taproot-overlay-chans",
|
SimpleTaprootOverlayChansOptional: "taproot-overlay-chans",
|
||||||
SimpleTaprootOverlayChansRequired: "taproot-overlay-chans",
|
SimpleTaprootOverlayChansRequired: "taproot-overlay-chans",
|
||||||
|
ExperimentalEndorsementRequired: "endorsement-x",
|
||||||
|
ExperimentalEndorsementOptional: "endorsement-x",
|
||||||
Bolt11BlindedPathsOptional: "bolt-11-blinded-paths",
|
Bolt11BlindedPathsOptional: "bolt-11-blinded-paths",
|
||||||
Bolt11BlindedPathsRequired: "bolt-11-blinded-paths",
|
Bolt11BlindedPathsRequired: "bolt-11-blinded-paths",
|
||||||
}
|
}
|
||||||
|
@@ -760,6 +760,10 @@ func (r *rpcServer) addDeps(s *server, macService *macaroons.Service,
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
ShouldSetExpEndorsement: func() bool {
|
ShouldSetExpEndorsement: func() bool {
|
||||||
|
if s.cfg.ProtocolOptions.NoExperimentalEndorsement() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return clock.NewDefaultClock().Now().Before(
|
return clock.NewDefaultClock().Now().Before(
|
||||||
EndorsementExperimentEnd,
|
EndorsementExperimentEnd,
|
||||||
)
|
)
|
||||||
|
@@ -1399,6 +1399,9 @@
|
|||||||
; Set to disable blinded route forwarding.
|
; Set to disable blinded route forwarding.
|
||||||
; protocol.no-route-blinding=false
|
; protocol.no-route-blinding=false
|
||||||
|
|
||||||
|
; Set to disable experimental endorsement signaling.
|
||||||
|
; protocol.no-experimental-endorsement=false
|
||||||
|
|
||||||
; Set to handle messages of a particular type that falls outside of the
|
; Set to handle messages of a particular type that falls outside of the
|
||||||
; custom message number range (i.e. 513 is onion messages). Note that you can
|
; custom message number range (i.e. 513 is onion messages). Note that you can
|
||||||
; set this option as many times as you want to support more than one custom
|
; set this option as many times as you want to support more than one custom
|
||||||
|
31
server.go
31
server.go
@@ -573,19 +573,20 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
|
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
featureMgr, err := feature.NewManager(feature.Config{
|
featureMgr, err := feature.NewManager(feature.Config{
|
||||||
NoTLVOnion: cfg.ProtocolOptions.LegacyOnion(),
|
NoTLVOnion: cfg.ProtocolOptions.LegacyOnion(),
|
||||||
NoStaticRemoteKey: cfg.ProtocolOptions.NoStaticRemoteKey(),
|
NoStaticRemoteKey: cfg.ProtocolOptions.NoStaticRemoteKey(),
|
||||||
NoAnchors: cfg.ProtocolOptions.NoAnchorCommitments(),
|
NoAnchors: cfg.ProtocolOptions.NoAnchorCommitments(),
|
||||||
NoWumbo: !cfg.ProtocolOptions.Wumbo(),
|
NoWumbo: !cfg.ProtocolOptions.Wumbo(),
|
||||||
NoScriptEnforcementLease: cfg.ProtocolOptions.NoScriptEnforcementLease(),
|
NoScriptEnforcementLease: cfg.ProtocolOptions.NoScriptEnforcementLease(),
|
||||||
NoKeysend: !cfg.AcceptKeySend,
|
NoKeysend: !cfg.AcceptKeySend,
|
||||||
NoOptionScidAlias: !cfg.ProtocolOptions.ScidAlias(),
|
NoOptionScidAlias: !cfg.ProtocolOptions.ScidAlias(),
|
||||||
NoZeroConf: !cfg.ProtocolOptions.ZeroConf(),
|
NoZeroConf: !cfg.ProtocolOptions.ZeroConf(),
|
||||||
NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(),
|
NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(),
|
||||||
CustomFeatures: cfg.ProtocolOptions.CustomFeatures(),
|
CustomFeatures: cfg.ProtocolOptions.CustomFeatures(),
|
||||||
NoTaprootChans: !cfg.ProtocolOptions.TaprootChans,
|
NoTaprootChans: !cfg.ProtocolOptions.TaprootChans,
|
||||||
NoTaprootOverlay: !cfg.ProtocolOptions.TaprootOverlayChans,
|
NoTaprootOverlay: !cfg.ProtocolOptions.TaprootOverlayChans,
|
||||||
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
||||||
|
NoExperimentalEndorsement: cfg.ProtocolOptions.NoExperimentalEndorsement(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -4221,6 +4222,10 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
|
|||||||
AuxChanCloser: s.implCfg.AuxChanCloser,
|
AuxChanCloser: s.implCfg.AuxChanCloser,
|
||||||
AuxResolver: s.implCfg.AuxContractResolver,
|
AuxResolver: s.implCfg.AuxContractResolver,
|
||||||
ShouldFwdExpEndorsement: func() bool {
|
ShouldFwdExpEndorsement: func() bool {
|
||||||
|
if s.cfg.ProtocolOptions.NoExperimentalEndorsement() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return clock.NewDefaultClock().Now().Before(
|
return clock.NewDefaultClock().Now().Before(
|
||||||
EndorsementExperimentEnd,
|
EndorsementExperimentEnd,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user