channeldb: add production taproot channel type support
What changed, and why it matters
This commit adds a new database flag and helper method so LND can tell apart experimental 'staging' taproot channels from the finalized 'production' version. It is a small infrastructure change (11 lines) and does not, by itself, change how funds are secured or how transactions are validated. It simply prepares the code to recognize a new channel variant.
No immediate action required. Treat as a normal feature/infrastructure commit. When follow-up commits begin using TaprootFinalBit to select witness types or script generation, those changes should be reviewed for correct validation of the bit combination and for compatibility with existing taproot channels.
Security signals we found
New channel-type bit added to persisted channel database schema
Bit is intended to gate future production taproot script paths
No validation, witness-generation, or signature logic is modified in this commit
Commit message frames the change as infrastructure for contract resolution
Evidence from the diff
The change introduces TaprootFinalBit (1<<12) in the ChannelType bitmask and an IsTaprootFinal() predicate in channeldb/channel.go. The bit is documented as requiring SimpleTaprootFeatureBit and as corresponding to feature bits 80/81 and optimized MuSig2 scripts. No logic that consumes this bit is present in the diff, so it is a forward-looking type discriminator rather than a behavioral change.
Changed components
channeldb/channel.go ChannelType constantschanneldb/channel.go ChannelType helper methodsInspect captured patch +11 / −0
diff --git a/channeldb/channel.go b/channeldb/channel.go
index be082ab..502d755 100644
--- a/channeldb/channel.go
+++ b/channeldb/channel.go
@@ -437,6 +437,11 @@ const (
// level tapscript commitment. This MUST be set along with the
// SimpleTaprootFeatureBit.
TapscriptRootBit ChannelType = 1 << 11
+
+ // TaprootFinalBit indicates that this is a MuSig2 channel using the
+ // final/production taproot scripts and feature bits 80/81. This MUST
+ // be set along with the SimpleTaprootFeatureBit.
+ TaprootFinalBit ChannelType = 1 << 12
)
// IsSingleFunder returns true if the channel type if one of the known single
@@ -513,6 +518,12 @@ func (c ChannelType) HasTapscriptRoot() bool {
return c&TapscriptRootBit == TapscriptRootBit
}
+// IsTaprootFinal returns true if the channel is using final/production taproot
+// scripts and feature bits.
+func (c ChannelType) IsTaprootFinal() bool {
+ return c&TaprootFinalBit == TaprootFinalBit
+}
+
// ChannelStateBounds are the parameters from OpenChannel and AcceptChannel
// that are responsible for providing bounds on the state space of the abstract
// channel state. These values must be remembered for normal channel operation
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.