#36005 rpc, descriptor: warn when multipath expansion clones single-path key expressions

full analysis

https://github.com/bitcoin/bitcoin/pull/36005 · pythcoiner · +145/-10 in 8 files, 4 commits · labels: Needs rebase

Goal

  • Warn users when single-path key expressions are cloned during multipath descriptor expansion
  • Prevent accidental key reuse between receive and change outputs
  • Expose descriptor warnings in getdescriptorinfo and deduplicate RPC warning outputs

This PR adds warnings to descriptors when single-path key expressions or Taproot subscripts are cloned across multipath expansions, preventing accidental key reuse across branches. It exposes descriptor warnings via a new warnings field in `getdescriptorinfo` and deduplicates repeated messages in the shared `PushWarnings` RPC helper.

Problem: When expanding multipath descriptors, single-path key expressions are silently cloned into each expanded branch, which can lead wallet users to reuse identical key material for both receive and change outputs without noticing.

Category: RPC / REST / ZMQ (#32 of 52)

P3 · new feature

  • P3 because it provides useful diagnostic parity by adding warnings to getdescriptorinfo
  • Avoids repetitive warning messages in RPC outputs

Extending getdescriptorinfo with a warnings array provides useful diagnostic parity with importdescriptors, and deduplicating PushWarnings avoids repetitive arrays in RPC outputs.

Membership: Adds a warnings field to getdescriptorinfo and modifies PushWarnings in src/rpc/util.cpp.

Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0

Category: Wallet (#35 of 84)

P3 · user request

  • P3 because it mitigates privacy loss when receive and change paths unintentionally share keys
  • Catches subtle misconfigurations without breaking valid descriptors

Warns against a subtle descriptor misconfiguration where receive and change paths unintentionally share key material, mitigating privacy loss without rejecting valid descriptors.

Membership: Touches descriptor validation and warnings surfaced by wallet descriptor imports in src/script/descriptor.cpp and test/functional/wallet_importdescriptors.py.

Factors: security/stability 1, bug 1, performance 0, user value 2, leverage 0

Reviewability: Stale: Needs rebase

  • Needs rebase due to merge conflicts with master

The PR has merge conflicts with current master and requires a rebase.

Author status: silent since 2026-08-18

Resolved concerns:

  • Test coverage nit regarding checking multiple simultaneous descriptor warnings (jeanpablojp)

Agreement: Strong

  • Strong support with no objections raised
  • Verified by mutating checks and validating test failures (jeanpablojp)

Strong: tested ACK with mutation verification from jeanpablojp; no objections raised

jeanpablojp verified and tested the patch thoroughly by mutating each check and verifying test failures, raising only a minor test coverage nit.

  • jeanpablojp left a tACK confirming test verification across descriptor parsing and RPC warning deduplication

Review verdicts (DrahtBot): 1

Files

89 lines under test/bench/ci.

  • src/test/descriptor_tests.cpp +54/-0
  • src/script/descriptor.cpp +19/-5
  • test/functional/wallet_importdescriptors.py +22/-0
  • doc/release-notes-36005.md +15/-0
  • test/functional/rpc_getdescriptorinfo.py +12/-1
  • src/rpc/output_script.cpp +12/-0
  • src/rpc/util.cpp +9/-3
  • src/rpc/util.h +2/-1

Card

This PR warns when multipath descriptor expansion clones single-path key expressions across branches, preventing unintentional key reuse between distinct paths like external receive and internal change. It also surfaces descriptor warnings in getdescriptorinfo and deduplicates warning strings across RPC outputs via PushWarnings. The change has a tested ACK from jeanpablojp verifying the coverage of each warning path. Review is currently blocked on a rebase.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T15:56, confidence high, input hash c1d8f2ee1c61fe5b