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

lnwallet: add secret nonce stashing to MusigSession for test vectors

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

83/100 · Strong
lnwallet: add secret nonce stashing to MusigSession for test vectors

In this commit, we add the ability for MusigSession to capture and
expose the raw 97-byte MuSig2 secret nonce generated during JIT signing
nonce creation. This is gated behind the customNonceRand option, so it
only activates in test vector generation mode.

The stashed secret nonce is consumed on read (cleared after access) to
prevent accidental nonce reuse. This enables interop test vectors to
include the raw secret nonces, allowing other implementations to replay
the MuSig2 signing process without needing to match the exact nonce
derivation algorithm used by btcd's musig2 library.
✓ 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 adds a test-only feature that lets LND temporarily save the secret random number (nonce) used in MuSig2 signing when running in a special test-vector generation mode. The saved value is automatically erased after one read to prevent accidental reuse. There is no indication this feature is active in normal production code, and the change is explicitly described as being for interoperability test vectors only.

Recommended action

Verify that customNonceRand can only be supplied by test code and is never reachable from RPC, wallet, or mainnet signing flows. Confirm that the consume-on-read clearing cannot be bypassed or observed by concurrent callers. No immediate security patch appears necessary, but treat any future expansion of this accessor as requiring careful review.

Security signals we found

01

Secret nonce is exposed through a new accessor, but only in test-vector mode gated by customNonceRand

02

Nonce is cleared after read to mitigate reuse risk

03

Change is explicitly framed by the commit message as test-only infrastructure for interoperability test vectors

04

No production signing path appears to enable customNonceRand based on the diff alone

Risk score

Why this scored 18/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 2/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.