diff --git a/feature/manager.go b/feature/manager.go index 6d7787950..26a3d4a31 100644 --- a/feature/manager.go +++ b/feature/manager.go @@ -40,6 +40,10 @@ type Config struct { // channels. This should be used instead of NoOptionScidAlias to still // keep option-scid-alias support. NoZeroConf bool + + // NoAnySegwit unsets any bits that signal support for using other + // segwit witness versions for co-op closes. + NoAnySegwit bool } // Manager is responsible for generating feature vectors for different requested @@ -142,6 +146,10 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) { raw.Unset(lnwire.ZeroConfOptional) raw.Unset(lnwire.ZeroConfRequired) } + if cfg.NoAnySegwit { + raw.Unset(lnwire.ShutdownAnySegwitOptional) + raw.Unset(lnwire.ShutdownAnySegwitRequired) + } // Ensure that all of our feature sets properly set any // dependent features. diff --git a/lncfg/protocol.go b/lncfg/protocol.go index 0e1bd80d6..03dfa71e9 100644 --- a/lncfg/protocol.go +++ b/lncfg/protocol.go @@ -38,6 +38,10 @@ type ProtocolOptions struct { // OptionZeroConf should be set if we want to signal the zero-conf // feature bit. OptionZeroConf bool `long:"zero-conf" description:"enable support for zero-conf channels, must have option-scid-alias set also"` + + // NoOptionAnySegwit should be set to true if we don't want to use any + // Taproot (and beyond) addresses for co-op closing. + NoOptionAnySegwit bool `long:"no-any-segwit" description:"disallow using any segiwt witness version as a co-op close address"` } // Wumbo returns true if lnd should permit the creation and acceptance of wumbo @@ -67,3 +71,9 @@ func (l *ProtocolOptions) ScidAlias() bool { func (l *ProtocolOptions) ZeroConf() bool { return l.OptionZeroConf } + +// NoAnySegwit returns true if we don't signal that we understand other newer +// segwit witness versions for co-op close addresses. +func (l *ProtocolOptions) NoAnySegwit() bool { + return l.NoOptionAnySegwit +} diff --git a/lncfg/protocol_rpctest.go b/lncfg/protocol_rpctest.go index 651e2606e..d2d4b197f 100644 --- a/lncfg/protocol_rpctest.go +++ b/lncfg/protocol_rpctest.go @@ -39,6 +39,10 @@ type ProtocolOptions struct { // OptionZeroConf should be set if we want to signal the zero-conf // feature bit. OptionZeroConf bool `long:"zero-conf" description:"enable support for zero-conf channels, must have option-scid-alias set also"` + + // NoOptionAnySegwit should be set to true if we don't want to use any + // Taproot (and beyond) addresses for co-op closing. + NoOptionAnySegwit bool `long:"no-any-segwit" description:"disallow using any segiwt witness version as a co-op close address"` } // Wumbo returns true if lnd should permit the creation and acceptance of wumbo @@ -68,3 +72,9 @@ func (l *ProtocolOptions) ScidAlias() bool { func (l *ProtocolOptions) ZeroConf() bool { return l.OptionZeroConf } + +// NoAnySegwit returns true if we don't signal that we understand other newer +// segwit witness versions for co-op close addresses. +func (l *ProtocolOptions) NoAnySegwit() bool { + return l.NoOptionAnySegwit +} diff --git a/sample-lnd.conf b/sample-lnd.conf index 5904918ab..aed084167 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1191,6 +1191,10 @@ litecoin.node=ltcd ; option-scid-alias flag to also be set. ; protocol.zero-conf=true +; Set to disable support for using P2TR addresses (and beyond) for co-op +; closing. +; protocol.no-any-segwit + [db] ; The selected database backend. The current default backend is "bolt". lnd diff --git a/server.go b/server.go index 990c02352..0d2adc7b8 100644 --- a/server.go +++ b/server.go @@ -536,6 +536,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, NoKeysend: !cfg.AcceptKeySend, NoOptionScidAlias: !cfg.ProtocolOptions.ScidAlias(), NoZeroConf: !cfg.ProtocolOptions.ZeroConf(), + NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(), }) if err != nil { return nil, err @@ -1577,6 +1578,7 @@ func (s *server) signAliasUpdate(u *lnwire.ChannelUpdate) (*ecdsa.Signature, // - diskCheck // - tlsHealthCheck // - torController, only created when tor is enabled. +// // If a health check has been disabled by setting attempts to 0, our monitor // will not run it. func (s *server) createLivenessMonitor(cfg *Config, cc *chainreg.ChainControl) {