AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 58 Bitcoin

graph/db: honor taproot feature bit in v1 funding script construction

Public commit record

What the developer wrote

Authored by Elle Mouton

83/100 · Strong
graph/db: honor taproot feature bit in v1 funding script construction

Fix FundingPKScript() to check for the taproot staging feature bit on
v1 channel edges. When present, reconstruct a taproot funding script
via GenTaprootFundingScript instead of the legacy P2WSH multisig.

This is a pre-existing bug: private taproot channels have always been
stored as v1 gossip objects with the taproot feature bit, but
FundingPKScript() never checked for it. The discovery/gossiper layer
(makeFundingScript) already handled this correctly on the insertion
path, but any read path that called FundingPKScript() -- notably
ChannelView() used for chain filter reconstruction on restart --
would produce the wrong script.

Update the tests from the previous commit to assert the correct
taproot funding script instead of the legacy P2WSH script.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a bug in the LND Lightning node where it could look up the wrong Bitcoin address (funding script) for certain private Taproot channels when rebuilding its chain filter after a restart. The wrong address was a legacy multisig address instead of the expected Taproot address. Because the node uses this filter to watch the blockchain for relevant transactions, using the wrong address could cause it to miss on-chain activity related to those channels. The commit makes the code check the channel's feature bits to decide which address type to reconstruct.

Recommended action

Apply the patch. After upgrade, nodes that had private taproot channels should verify that chain filters are rebuilt correctly; consider monitoring for any missed on-chain events on affected channels and, if necessary, force a rescan or filter refresh. Review whether any other read paths still call FundingPKScript() without loaded feature bits.

Security signals we found

01

Incorrect funding script reconstruction on read path

02

Chain filter (rescan/watch filter) could omit relevant taproot channel funding outputs

03

Mismatch between insertion path (makeFundingScript) and read path (FundingPKScript)

04

Private taproot channels affected because stored as v1 gossip with taproot feature bit

05

Potential missed on-chain events for affected channels after restart

Risk score

Why this scored 58/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 10/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.