bitcoin/src/script
glozow f93d5553d1
Merge bitcoin/bitcoin#22838: descriptors: Be able to specify change and receiving in a single descriptor string
a0abcbd382 doc: Mention multipath specifier (Ava Chow)
0019f61fc5 tests: Test importing of multipath descriptors (Ava Chow)
f97d5c137d wallet, rpc: Allow importdescriptors to import multipath descriptors (Ava Chow)
32dcbca3fb rpc: Allow importmulti to import multipath descriptors correctly (Ava Chow)
64dfe3ce4b wallet: Move internal to be per key when importing (Ava Chow)
1692245525 tests: Multipath descriptors for scantxoutset and deriveaddresses (Ava Chow)
cddc0ba9a9 rpc: Have deriveaddresses derive receiving and change (Ava Chow)
360456cd22 tests: Multipath descriptors for getdescriptorinfo (Ava Chow)
a90eee444c tests: Add unit tests for multipath descriptors (Ava Chow)
1bbf46e2da descriptors: Change Parse to return vector of descriptors (Ava Chow)
0d640c6f02 descriptors: Have ParseKeypath handle multipath specifiers (Ava Chow)
a5f39b1034 descriptors: Change ParseScript to return vector of descriptors (Ava Chow)
0d55deae15 descriptors: Add DescriptorImpl::Clone (Ava Chow)
7e86541f72 descriptors: Add PubkeyProvider::Clone (Ava Chow)

Pull request description:

  It is convenient to have a descriptor which specifies both receiving and change addresses in a single string. However, as discussed in https://github.com/bitcoin/bitcoin/issues/17190#issuecomment-895515768, it is not feasible to use a generic multipath specification like BIP 88 due to combinatorial blow up and that it would result in unexpected descriptors.

  To resolve that problem, this PR proposes a targeted solution which allows only a single pair of 2 derivation indexes to be inserted in the place of a single derivation index. So instead of two descriptor `wpkh(xpub.../0/0/*)` and `wpkh(xpub.../0/1/*)` to represent receive and change addresses, this could be written as `wpkh(xpub.../0/<0;1>/*)`. The multipath specifier is of the form `<NUM;NUM>`. Each `NUM` can have its own hardened specifier, e.g. `<0;1h>` is valid. The multipath specifier can also only appear in one path index in the derivation path.

  This results in the parser returning two descriptors. The first descriptor uses the first `NUM` in all pairs present, and the second uses the second `NUM`. In our implementation, if a multipath descriptor is not provided, a pair is still returned, but the second element is just `nullptr`.

  The wallet will not output the multipath descriptors (yet). Furthermore, when a multipath descriptor is imported, it is expanded to the two descriptors and each imported on its own, with the second descriptor being implicitly for internal (change) addresses. There is no change to how the wallet stores or outputs descriptors (yet).

  Note that the path specifier is different from what was proposed. It uses angle brackets and the semicolon because these are unused characters available in the character set and I wanted to avoid conflicts with characters already in use in descriptors.

  Closes #17190

ACKs for top commit:
  darosior:
    re-ACK a0abcbd382
  mjdietzx:
    reACK a0abcbd382
  pythcoiner:
    reACK a0abcbd
  furszy:
    Code review ACK a0abcbd
  glozow:
    light code review ACK a0abcbd382

Tree-SHA512: 84ea40b3fd1b762194acd021cae018c2f09b98e595f5e87de5c832c265cfe8a6d0bc4dae25785392fa90db0f6301ddf9aea787980a29c74f81d04b711ac446c2
2024-08-28 15:56:15 +01:00
..
descriptor.cpp Merge bitcoin/bitcoin#22838: descriptors: Be able to specify change and receiving in a single descriptor string 2024-08-28 15:56:15 +01:00
descriptor.h descriptors: Change Parse to return vector of descriptors 2024-08-08 12:47:22 -04:00
interpreter.cpp policy: make anchor spend standard 2024-07-30 14:06:58 -04:00
interpreter.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
keyorigin.h Implement operator< for KeyOriginInfo and CExtPubKey 2021-12-10 08:29:47 -05:00
miniscript.cpp miniscript: make operator_mst consteval 2024-05-03 11:38:14 -04:00
miniscript.h miniscript: Use ToIntegral instead of ParseInt64 2024-08-05 08:23:24 -03:00
parsing.cpp util: move spanparsing.h to script/parsing.h 2024-05-16 10:16:08 -05:00
parsing.h util: move spanparsing.h to script/parsing.h 2024-05-16 10:16:08 -05:00
script.cpp policy: Add OP_1 <0x4e73> as a standard output type 2024-07-30 14:06:58 -04:00
script.h Merge bitcoin/bitcoin#29369: refactor: Allow CScript construction from any std::input_iterator 2024-08-27 14:09:56 -04:00
script_error.cpp Implement Tapscript script validation rules (BIP 342) 2020-10-12 17:18:24 -07:00
script_error.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
sigcache.cpp kernel: De-globalize signature cache 2024-07-05 09:03:04 +02:00
sigcache.h kernel: De-globalize signature cache 2024-07-05 09:03:04 +02:00
sign.cpp policy: Add OP_1 <0x4e73> as a standard output type 2024-07-30 14:06:58 -04:00
sign.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
signingprovider.cpp ci: Bump TIDY_LLVM_V 2024-03-15 13:34:05 +00:00
signingprovider.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
solver.cpp policy: Add OP_1 <0x4e73> as a standard output type 2024-07-30 14:06:58 -04:00
solver.h policy: Add OP_1 <0x4e73> as a standard output type 2024-07-30 14:06:58 -04:00