From 7323e9373be380f859354daef0fd3ec17e447c59 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 25 Jul 2023 17:44:59 -0700 Subject: [PATCH] feature+lncfg: add new CLI flag to opt into taproot chans --- feature/manager.go | 8 ++++++++ lncfg/protocol.go | 4 ++++ lncfg/protocol_integration.go | 4 ++++ sample-lnd.conf | 3 +++ server.go | 1 + 5 files changed, 20 insertions(+) diff --git a/feature/manager.go b/feature/manager.go index e7db9899a..5a6034593 100644 --- a/feature/manager.go +++ b/feature/manager.go @@ -35,6 +35,10 @@ type Config struct { // NoWumbo unsets any bits signalling support for wumbo channels. NoWumbo bool + // NoTaprootChans unsets any bits signaling support for taproot + // channels. + NoTaprootChans bool + // NoScriptEnforcementLease unsets any bits signaling support for script // enforced leases. NoScriptEnforcementLease bool @@ -171,6 +175,10 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) { raw.Unset(lnwire.ShutdownAnySegwitOptional) raw.Unset(lnwire.ShutdownAnySegwitRequired) } + if cfg.NoTaprootChans { + raw.Unset(lnwire.SimpleTaprootChannelsOptional) + raw.Unset(lnwire.SimpleTaprootChannelsRequired) + } for _, custom := range cfg.CustomFeatures[set] { if custom > set.Maximum() { diff --git a/lncfg/protocol.go b/lncfg/protocol.go index 876b009c1..e4e5c56e7 100644 --- a/lncfg/protocol.go +++ b/lncfg/protocol.go @@ -22,6 +22,10 @@ type ProtocolOptions struct { // mini. WumboChans bool `long:"wumbo-channels" description:"if set, then lnd will create and accept requests for channels larger chan 0.16 BTC"` + // TaprootChans should be set if we want to enable support for the + // experimental simple taproot chans commitment type. + TaprootChans bool `long:"taproot-chans" description:"if set, then lnd will create and accept requests for channels using the simple taproot commitment type"` + // NoAnchors should be set if we don't want to support opening or accepting // channels having the anchor commitment type. NoAnchors bool `long:"no-anchors" description:"disable support for anchor commitments"` diff --git a/lncfg/protocol_integration.go b/lncfg/protocol_integration.go index b2c64cb47..b758a188d 100644 --- a/lncfg/protocol_integration.go +++ b/lncfg/protocol_integration.go @@ -24,6 +24,10 @@ type ProtocolOptions struct { // mini. WumboChans bool `long:"wumbo-channels" description:"if set, then lnd will create and accept requests for channels larger chan 0.16 BTC"` + // TaprootChans should be set if we want to enable support for the + // experimental simple taproot chans commitment type. + TaprootChans bool `long:"taproot-chans" description:"if set, then lnd will create and accept requests for channels using the simple taproot commitment type"` + // Anchors enables anchor commitments. // TODO(halseth): transition itests to anchors instead! Anchors bool `long:"anchors" description:"enable support for anchor commitments"` diff --git a/sample-lnd.conf b/sample-lnd.conf index bf738cadb..66b83fbdc 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1461,6 +1461,9 @@ ; protocol.no-any-segwit=false +; Set to enable support for the experimental taproot channel type. +; protocol.simple-taproot-chans + [db] ; The selected database backend. The current default backend is "bolt". lnd diff --git a/server.go b/server.go index 82f2697b0..b59f873cf 100644 --- a/server.go +++ b/server.go @@ -542,6 +542,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, NoZeroConf: !cfg.ProtocolOptions.ZeroConf(), NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(), CustomFeatures: cfg.ProtocolOptions.ExperimentalProtocol.CustomFeatures(), + NoTaprootChans: !cfg.ProtocolOptions.TaprootChans, }) if err != nil { return nil, err