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

wallet: fix `gethdkeys` RPC for descriptors with partial xprvs

Public commit record

What the developer wrote

Authored by rkrux

78/100 · Adequate
wallet: fix `gethdkeys` RPC for descriptors with partial xprvs

A non-watch-only wallet allows to import descriptors with partial
private keys, eg: a multisig descriptor with one private key and
one public key. In case an xpub is imported in any such descriptors
whose private key the wallet doesn't have, then the `gethdkeys` RPC
throws an unhandled error like below when the private keys are
requested.

This fix ensures that such calls are properly handled by conditionally
finding the corresponding xprv. Some related documentation of this RPC
is also updated.

```
➜ bitcoincli -named gethdkeys private=true
error code: -1
error message:
map::at: key not found
```
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in Bitcoin Core's `gethdkeys` RPC command. The command can crash with an unhandled 'key not found' error when a user requests private key information for a wallet that contains descriptors where some extended public keys (xpubs) do not have corresponding private keys in the wallet. The fix prevents the crash by only trying to return the private key when the wallet actually has it, and it updates the related documentation to clarify that the descriptor string shown is the public version.

Recommended action

Apply the patch. It is a minimal, targeted fix that prevents an RPC crash and improves documentation clarity. No immediate incident response is indicated beyond normal merge and release.

Security signals we found

01

Unhandled std::out_of_range exception in RPC path

02

Crash/DoS condition in wallet RPC when private=true and descriptor has partial xprvs

03

Informational documentation update clarifying descriptor string is public

Risk score

Why this scored 33/100

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