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

Return P2WSH script pubkey for keyed anchor prevouts

Public commit record

What the developer wrote

Authored by Elias Rohrer

73/100 · Adequate
Return P2WSH script pubkey for keyed anchor prevouts

AnchorDescriptor::previous_utxo is used for coin selection and PSBT witness_utxo metadata. For keyed anchors it should describe the on-chain P2WSH anchor output instead of the witness script so wallets can validate and sign the package.

Co-Authored-By: HAL 9000

This finding was discovered by Project Loupe
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in how Lightning Dev Kit describes anchor outputs when preparing transactions for external wallets to sign. Previously, for a type of anchor tied to a specific channel key, the code returned the raw 'witness script' (the spending conditions) instead of the proper P2WSH address/script pubkey. Wallets use this data to identify and validate the coin being spent. Providing the wrong descriptor could cause wallets to reject the PSBT or, in worst cases, misidentify the output, potentially leading to invalid transactions or unsafe signing behavior. The fix converts the redeemscript to its P2WSH script pubkey, and adds a regression test.

Recommended action

Review and merge the patch. Ensure downstream wallets/signers that consume AnchorDescriptor::previous_utxo validate P2WSH script pubkeys correctly. Consider auditing other descriptor types for similar scriptPubKey vs witness script confusion.

Security signals we found

01

Incorrect scriptPubKey in PSBT witness_utxo metadata for anchor prevouts

02

Potential wallet/signer validation failure when signing fee-bumping transactions

03

Risk of misidentification of on-chain anchor output during CPFP/RBF bumping

04

Regression test added for keyed anchor P2WSH script pubkey

05

Discovered by external security review (Project Loupe)

Risk score

Why this scored 44/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 7/15
Confidence 7/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.