feature+lncfg: add config option to turn of anysegwit

This commit is contained in:
Olaoluwa Osuntokun 2022-08-04 19:09:39 -07:00
parent fffad49ad1
commit 89529fbb4f
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306
5 changed files with 34 additions and 0 deletions

View File

@ -40,6 +40,10 @@ type Config struct {
// channels. This should be used instead of NoOptionScidAlias to still // channels. This should be used instead of NoOptionScidAlias to still
// keep option-scid-alias support. // keep option-scid-alias support.
NoZeroConf bool 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 // 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.ZeroConfOptional)
raw.Unset(lnwire.ZeroConfRequired) 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 // Ensure that all of our feature sets properly set any
// dependent features. // dependent features.

View File

@ -38,6 +38,10 @@ type ProtocolOptions struct {
// OptionZeroConf should be set if we want to signal the zero-conf // OptionZeroConf should be set if we want to signal the zero-conf
// feature bit. // feature bit.
OptionZeroConf bool `long:"zero-conf" description:"enable support for zero-conf channels, must have option-scid-alias set also"` 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 // 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 { func (l *ProtocolOptions) ZeroConf() bool {
return l.OptionZeroConf 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
}

View File

@ -39,6 +39,10 @@ type ProtocolOptions struct {
// OptionZeroConf should be set if we want to signal the zero-conf // OptionZeroConf should be set if we want to signal the zero-conf
// feature bit. // feature bit.
OptionZeroConf bool `long:"zero-conf" description:"enable support for zero-conf channels, must have option-scid-alias set also"` 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 // 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 { func (l *ProtocolOptions) ZeroConf() bool {
return l.OptionZeroConf 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
}

View File

@ -1191,6 +1191,10 @@ litecoin.node=ltcd
; option-scid-alias flag to also be set. ; option-scid-alias flag to also be set.
; protocol.zero-conf=true ; protocol.zero-conf=true
; Set to disable support for using P2TR addresses (and beyond) for co-op
; closing.
; protocol.no-any-segwit
[db] [db]
; The selected database backend. The current default backend is "bolt". lnd ; The selected database backend. The current default backend is "bolt". lnd

View File

@ -536,6 +536,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
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(),
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -1577,6 +1578,7 @@ func (s *server) signAliasUpdate(u *lnwire.ChannelUpdate) (*ecdsa.Signature,
// - diskCheck // - diskCheck
// - tlsHealthCheck // - tlsHealthCheck
// - torController, only created when tor is enabled. // - torController, only created when tor is enabled.
//
// If a health check has been disabled by setting attempts to 0, our monitor // If a health check has been disabled by setting attempts to 0, our monitor
// will not run it. // will not run it.
func (s *server) createLivenessMonitor(cfg *Config, cc *chainreg.ChainControl) { func (s *server) createLivenessMonitor(cfg *Config, cc *chainreg.ChainControl) {