Fixes #35629.
Multipath Miniscript descriptors performed duplicate-key sanity checking while parsing the template, when key comparison used the first multipath branch. As a result, duplicate keys present only in a later branch were accepted.
Select each expanded multipath branch and rerun the existing duplicate-key check before constructing the final descriptors. If a branch contains a duplicate, report the offending concrete Miniscript expression.
The regression test covers:
- a valid two-branch
wshcontrol; - a duplicate in the second
wshbranch; - a duplicate in the third of three
trbranches.
Tested with:
build/bin/test_bitcoin --run_test=descriptor_tests/multipath_miniscript_duplicate_keys
build/bin/test_bitcoin --run_test=descriptor_tests
build/bin/test_bitcoin