WIP: descriptor: Reconstruct a multipath descriptor from its expansion #36443

Draft
achow101 wants to merge 12 commits from multipath-reconstruction into master AGit
achow101 commented 2026-10-05 22:16:19 +00:00 (Migrated from github.com)

#36442 allows multipath descriptors to be represented in a single Descriptor object. GetMultipathExpansion returns the multiple descriptors represented by a multipath descriptor. This expansion is reversible - given the expansion in the order of the multipath elements, it is possible to determine what the original multipath descriptor was. This PR adds ReconstructMultipath to produce a new Descriptor representing the multipath descriptor that produced the expansion.

Depends on #36442

#36442 allows multipath descriptors to be represented in a single `Descriptor` object. `GetMultipathExpansion` returns the multiple descriptors represented by a multipath descriptor. This expansion is reversible - given the expansion in the order of the multipath elements, it is possible to determine what the original multipath descriptor was. This PR adds `ReconstructMultipath` to produce a new `Descriptor` representing the multipath descriptor that produced the expansion. Depends on #36442
DrahtBot commented 2026-10-05 22:16:28 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept ACK w0xlt, rkrux

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36885 (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc)
  • #36820 (refactor: remove more dead code by fanquake)
  • #36648 (descriptor, rpc, wallet: do not echo key material in error messages by fametrano)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
  • #36070 (wallet: Add deriveHDKey interface by PraneethGunas)
  • #36005 (rpc, descriptor: warn when multipath expansion clones single-path key expressions by pythcoiner)
  • #35918 (descriptor: Expose key expression parsing by pseudoramdom)
  • #35377 (wallet: Allow importing of descriptors without private keys when the wallet has the private keys by achow101)
  • #34909 (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • src/util/bip32.h: for a give multipath position → for a given multipath position [misspelling]
  • src/test/descriptor_tests.cpp: Failed reconstrcted to private string → Failed to reconstruct private string [misspelling and unclear phrasing]
  • src/test/descriptor_tests.cpp: Failed reconstructed to private string → Failed to reconstruct private string [broken phrasing]

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • src/qt/test/wallettests.cpp: WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1)
  • src/script/descriptor.cpp: std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, false)
  • src/script/descriptor.cpp: std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, true)
  • src/test/fuzz/scriptpubkeyman.cpp: Parse(desc_str.value(), keys, error, false)
  • src/wallet/scriptpubkeyman.cpp: WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0)
  • src/wallet/scriptpubkeyman.cpp: Parse(desc_str, provider, error, false)
  • src/wallet/scriptpubkeyman.cpp: Parse(desc_str, parsed_keys, parse_error, false)
  • src/wallet/scriptpubkeyman.cpp: WalletDescriptor w_desc(std::move(desc), 0, 0, chain_counter, 0)
  • src/wallet/test/psbt_wallet_tests.cpp: WalletDescriptor w_desc(std::move(desc), 0, 0, 10, 0)
  • src/wallet/test/util.cpp: Parse(desc_str, keys, error, false)
  • src/wallet/test/wallet_tests.cpp: WalletDescriptor w_desc{std::move(desc), 0, 0, 0, 0}
  • src/wallet/wallet.cpp: Parse(desc_str, keys, desc_error, false)
  • src/wallet/walletutil.cpp: Parse(desc_str, keys, error, false)

2026-11-07 03:08:11

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36443 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36443.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36443#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | Concept ACK | [w0xlt](https://github.com/bitcoin/bitcoin/pull/36443#issuecomment-6066076341), [rkrux](https://github.com/bitcoin/bitcoin/pull/36443#issuecomment-7192326214) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36885](https://github.com/bitcoin/bitcoin/pull/36885) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36885.svg"></sub> (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc) * [#36820](https://github.com/bitcoin/bitcoin/pull/36820) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36820.svg"></sub> (refactor: remove more dead code by fanquake) * [#36648](https://github.com/bitcoin/bitcoin/pull/36648) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36648.svg"></sub> (descriptor, rpc, wallet: do not echo key material in error messages by fametrano) * [#36122](https://github.com/bitcoin/bitcoin/pull/36122) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr) * [#36070](https://github.com/bitcoin/bitcoin/pull/36070) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36070.svg"></sub> (wallet: Add deriveHDKey interface by PraneethGunas) * [#36005](https://github.com/bitcoin/bitcoin/pull/36005) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36005.svg"></sub> (rpc, descriptor: warn when multipath expansion clones single-path key expressions by pythcoiner) * [#35918](https://github.com/bitcoin/bitcoin/pull/35918) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35918.svg"></sub> (descriptor: Expose key expression parsing by pseudoramdom) * [#35377](https://github.com/bitcoin/bitcoin/pull/35377) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35377.svg"></sub> (wallet: Allow importing of descriptors without private keys when the wallet has the private keys by achow101) * [#34909](https://github.com/bitcoin/bitcoin/pull/34909) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34909.svg"></sub> (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3--> ### LLM Linter (✨ experimental) Possible typos and grammar issues: - `src/util/bip32.h`: `for a give multipath position` → `for a given multipath position` [misspelling] - `src/test/descriptor_tests.cpp`: `Failed reconstrcted to private string` → `Failed to reconstruct private string` [misspelling and unclear phrasing] - `src/test/descriptor_tests.cpp`: `Failed reconstructed to private string` → `Failed to reconstruct private string` [broken phrasing] Possible places where named args for integral literals may be used (e.g. `func(x, /*named_arg=*/0)` in C++, and `func(x, named_arg=0)` in Python): - `src/qt/test/wallettests.cpp`: `WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1)` - `src/script/descriptor.cpp`: `std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, false)` - `src/script/descriptor.cpp`: `std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, true)` - `src/test/fuzz/scriptpubkeyman.cpp`: `Parse(desc_str.value(), keys, error, false)` - `src/wallet/scriptpubkeyman.cpp`: `WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0)` - `src/wallet/scriptpubkeyman.cpp`: `Parse(desc_str, provider, error, false)` - `src/wallet/scriptpubkeyman.cpp`: `Parse(desc_str, parsed_keys, parse_error, false)` - `src/wallet/scriptpubkeyman.cpp`: `WalletDescriptor w_desc(std::move(desc), 0, 0, chain_counter, 0)` - `src/wallet/test/psbt_wallet_tests.cpp`: `WalletDescriptor w_desc(std::move(desc), 0, 0, 10, 0)` - `src/wallet/test/util.cpp`: `Parse(desc_str, keys, error, false)` - `src/wallet/test/wallet_tests.cpp`: `WalletDescriptor w_desc{std::move(desc), 0, 0, 0, 0}` - `src/wallet/wallet.cpp`: `Parse(desc_str, keys, desc_error, false)` - `src/wallet/walletutil.cpp`: `Parse(desc_str, keys, error, false)` <sup>2026-11-07 03:08:11</sup>
First-time contributor

8 additional verified findings in the full report.

Earlier concerns remain unresolved; see the full report for their current assessments.

🟠 Minor · Reconstruction accepts repeated branches and can produce rejected descriptor syntax

Repeated branches can make reconstruction return duplicate multipath indexes or silently omit an input instead of rejecting the sequence.

Location: src/script/descriptor.cpp:709 (head).

🟠 Minor · getdescriptorinfo help still describes the old multipath result

For multipath input, descriptor now contains the full expression rather than the first branch, but RPC help still promises the old result.

Location: src/rpc/output_script.cpp:212 (head).

🟠 Minor · Mixed hardened markers change Miniscript compatibility hashes

Preserving each hardened marker changes the COMPAT string and new-import SPKM ID for mixed-marker Miniscript input, despite the documented stable-hash contract.

Location: src/script/descriptor.cpp:589 (head).

🔵 Suggestion · Descriptor evaluation rebuilds the multipath expansion at every index

Each ranged derivation index deep-clones the descriptor again and discards fixed-participant MuSig aggregation state that base reused.

Location: src/rpc/util.cpp:1368 (head).

🔵 Suggestion · Multipath expansion copies every alternative into every branch

Clone-then-select performs quadratic alternative copies where base's placeholder substitution was linear.

Location: src/script/descriptor.cpp:1330 (head).

🔵 Suggestion · Single-path operations silently accept unexpanded multipath objects

Expansion uses branch 0 while origin metadata can retain alternatives, leaving correctness dependent on callers selecting a branch first.

Location: src/script/descriptor.cpp:530 (head).

Review coverage was incomplete.


Reviewed: 09d019a4c86c · Full review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:055d1cd96b176486294e0a3d052a7e506a00c1f0c7c35fbf579b09cfe6d615cd:237cc81563f53f26a84ba90acce49f0597b0e28b0a77aa425401db6e90431c0b --> <!-- ralph-base:5bf3bc5e263407a252c14a17afe04fc3bf24a889 --> <!-- ralph-head:09d019a4c86c610096f5b19c9118b12eb26a81b7 --> <!-- ralph-case:1f20bc790c991eae69b336db6f89df4a32da80aeb627d03b11ad52ebc0a3c099 --> [8 additional verified findings in the full report](<https://review.fish.foo/traces/36443-09d019a4c86c610096f5b19c9118b12eb26a81b7-2351-7.html>). Earlier concerns remain unresolved; see the full report for their current assessments. **🟠 Minor · Reconstruction accepts repeated branches and can produce rejected descriptor syntax** Repeated branches can make reconstruction return duplicate multipath indexes or silently omit an input instead of rejecting the sequence. Location: [`src/script/descriptor.cpp:709`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/script/descriptor.cpp#L709>) (head). **🟠 Minor · getdescriptorinfo help still describes the old multipath result** For multipath input, `descriptor` now contains the full expression rather than the first branch, but RPC help still promises the old result. Location: [`src/rpc/output_script.cpp:212`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/rpc/output_script.cpp#L212>) (head). **🟠 Minor · Mixed hardened markers change Miniscript compatibility hashes** Preserving each hardened marker changes the COMPAT string and new-import SPKM ID for mixed-marker Miniscript input, despite the documented stable-hash contract. Location: [`src/script/descriptor.cpp:589`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/script/descriptor.cpp#L589>) (head). **🔵 Suggestion · Descriptor evaluation rebuilds the multipath expansion at every index** Each ranged derivation index deep-clones the descriptor again and discards fixed-participant MuSig aggregation state that base reused. Location: [`src/rpc/util.cpp:1368`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/rpc/util.cpp#L1368>) (head). **🔵 Suggestion · Multipath expansion copies every alternative into every branch** Clone-then-select performs quadratic alternative copies where base's placeholder substitution was linear. Location: [`src/script/descriptor.cpp:1330`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/script/descriptor.cpp#L1330>) (head). **🔵 Suggestion · Single-path operations silently accept unexpanded multipath objects** Expansion uses branch 0 while origin metadata can retain alternatives, leaving correctness dependent on callers selecting a branch first. Location: [`src/script/descriptor.cpp:530`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7/src/script/descriptor.cpp#L530>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`09d019a4c86c`](<https://git.fish.foo/bitcoin/bitcoin/commit/09d019a4c86c610096f5b19c9118b12eb26a81b7>) · [Full review report](<https://review.fish.foo/traces/36443-09d019a4c86c610096f5b19c9118b12eb26a81b7-2351-7.html>) · [Previous reports](<https://review.fish.foo/traces/36443/>) [permalink](<https://review.fish.foo/traces/36443-09d019a4c86c610096f5b19c9118b12eb26a81b7-2351-7.html>)
DrahtBot commented 2026-10-05 22:36:26 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task macOS-cross to arm64: https://github.com/bitcoin/bitcoin/actions/runs/37381386585/job/112003972868
LLM reason (✨ experimental): CI failed to compile walletload_tests.cpp: Parse() returns a std::unique_ptr<Descriptor>, but the code assigns it to a vector of those pointers.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `macOS-cross to arm64`: https://github.com/bitcoin/bitcoin/actions/runs/37381386585/job/112003972868</sub> <sub>LLM reason (✨ experimental): CI failed to compile `walletload_tests.cpp`: `Parse()` returns a `std::unique_ptr<Descriptor>`, but the code assigns it to a vector of those pointers.</sub> <details><summary>Hints</summary> Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example: * Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch. * A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test. * An intermittent issue. Leave a comment here, if you need help tracking down a confusing failure. </details>
DrahtBot commented 2026-10-07 13:58:24 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
w0xlt commented 2026-10-08 18:06:57 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
DrahtBot commented 2026-10-21 14:01:29 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
fametrano (Migrated from github.com) reviewed 2026-10-23 06:18:42 +00:00
fametrano (Migrated from github.com) left a comment

ReconstructMultipath accepts relatives that repeat a path value, and then returns a descriptor that is not their multipath form.

I tested it with a small harness against btclib-wallet, a BIP389 implementation I maintain. Its expansions of 24 multipath descriptors each came back as the original. Thirteen mismatched sets (different keys, function, threshold, timelock, key order, tree shape, origin, wildcard or range, two changed steps in one key, musig steps at both levels) return null, as they should.

Repeated values are not caught. wpkh(X/0/*), wpkh(X/1/*), wpkh(X/0/*) gives wpkh(X/<0;1;0>/*), which Parse refuses as a duplicate. wpkh(X/0/*) twice and then wpkh(X/1/*) gives wpkh(X/<0;1>/*): two elements for three inputs. Two identical inputs give the single-path descriptor back. In BIP32PubkeyProvider::ReconstructMultipath, each relative is compared with p after AddMultipathIndex has already extended it. So a repeat is skipped while p still holds one index, and appended once it holds more. Nothing checks the indexes already in p, or that the step ends with one index per input. The inline suggestions add both checks, with a test for the repeated cases, musig included. I can share the harness and its outputs.

`ReconstructMultipath` accepts relatives that repeat a path value, and then returns a descriptor that is not their multipath form. I tested it with a small harness against btclib-wallet, a BIP389 implementation I maintain. Its expansions of 24 multipath descriptors each came back as the original. Thirteen mismatched sets (different keys, function, threshold, timelock, key order, tree shape, origin, wildcard or range, two changed steps in one key, musig steps at both levels) return null, as they should. Repeated values are not caught. `wpkh(X/0/*)`, `wpkh(X/1/*)`, `wpkh(X/0/*)` gives `wpkh(X/<0;1;0>/*)`, which `Parse` refuses as a duplicate. `wpkh(X/0/*)` twice and then `wpkh(X/1/*)` gives `wpkh(X/<0;1>/*)`: two elements for three inputs. Two identical inputs give the single-path descriptor back. In `BIP32PubkeyProvider::ReconstructMultipath`, each relative is compared with `p` after `AddMultipathIndex` has already extended it. So a repeat is skipped while `p` still holds one index, and appended once it holds more. Nothing checks the indexes already in `p`, or that the step ends with one index per input. The inline suggestions add both checks, with a test for the repeated cases, musig included. I can share the harness and its outputs.
fametrano (Migrated from github.com) commented 2026-10-23 06:18:43 +00:00

A relative whose index is already in the step is a repeat, so reject it.

                    if (std::ranges::find(p.Indexes(), rp.Index(0)) != p.Indexes().end()) return false;
                    p.AddMultipathIndex(rp.Index(0));
A relative whose index is already in the step is a repeat, so reject it. ```suggestion if (std::ranges::find(p.Indexes(), rp.Index(0)) != p.Indexes().end()) return false; p.AddMultipathIndex(rp.Index(0)); ```
fametrano (Migrated from github.com) commented 2026-10-23 06:18:43 +00:00

Same check for the musig path.

                    if (std::ranges::find(p.Indexes(), rp.Index(0)) != p.Indexes().end()) return false;
                    p.AddMultipathIndex(rp.Index(0));
Same check for the musig path. ```suggestion if (std::ranges::find(p.Indexes(), rp.Index(0)) != p.Indexes().end()) return false; p.AddMultipathIndex(rp.Index(0)); ```
fametrano (Migrated from github.com) commented 2026-10-23 06:18:43 +00:00

Fail unless the step ends with one index per input. This also rejects identical inputs.

        // Each relative must add one multipath index
        if (!relatives.empty() && multipath_len != relatives.size() + 1) return nullptr;

        return out;
Fail unless the step ends with one index per input. This also rejects identical inputs. ```suggestion // Each relative must add one multipath index if (!relatives.empty() && multipath_len != relatives.size() + 1) return nullptr; return out; ```
fametrano (Migrated from github.com) commented 2026-10-23 06:18:43 +00:00

Add the repeated-value cases, with and without musig.

    });
    CheckFailedMultipathReconstruction({
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/1)",
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
    });
    CheckFailedMultipathReconstruction({
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/1)",
    });
    CheckFailedMultipathReconstruction({
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
        "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)",
    });
    CheckFailedMultipathReconstruction({
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)",
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/2)",
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)",
    });
    CheckFailedMultipathReconstruction({
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)",
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)",
        "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/2)",
    });
Add the repeated-value cases, with and without musig. ```suggestion }); CheckFailedMultipathReconstruction({ "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/1)", "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", }); CheckFailedMultipathReconstruction({ "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/1)", }); CheckFailedMultipathReconstruction({ "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", "wpkh(xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0)", }); CheckFailedMultipathReconstruction({ "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)", "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/2)", "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)", }); CheckFailedMultipathReconstruction({ "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)", "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/1)", "tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/2)", }); ```
DrahtBot commented 2026-11-05 12:06:38 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
DrahtBot commented 2026-11-24 16:58:16 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
rkrux commented 2026-11-26 12:41:12 +00:00 (Migrated from github.com)

Concept ACK, seems like a natural follow-up of the precursor #36442.

Concept ACK, seems like a natural follow-up of the precursor #36442.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36443
No description provided.