bitcoin/src/rpc
Ryan Ofsky 4373414d26
Merge bitcoin/bitcoin#29130: wallet: Add createwalletdescriptor and gethdkeys RPCs for adding new automatically generated descriptors
746b6d8839 test: Add test for createwalletdescriptor (Ava Chow)
2402b63062 wallet: Test upgrade of pre-taproot wallet to have tr() descriptors (Ava Chow)
460ae1bf67 wallet, rpc: Add createwalletdescriptor RPC (Ava Chow)
8e1a475062 wallet: Be able to retrieve single key from descriptors (Ava Chow)
85b1fb19dd wallet: Add GetActiveHDPubKeys to retrieve xpubs from active descriptors (Ava Chow)
73926f2d31 wallet, descspkm: Refactor wallet descriptor generation to standalone func (Andrew Chow)
54e74f46ea wallet: Refactor function for single DescSPKM setup (Andrew Chow)
3b09d0eb7f tests: Test for gethdkeys (Ava Chow)
5febe28c9e wallet, rpc: Add gethdkeys RPC (Ava Chow)
66632e5c24 wallet: Add IsActiveScriptPubKeyMan (Ava Chow)
fa6a259985 desc spkm: Add functions to retrieve specific private keys (Ava Chow)
fe67841464 descriptor: Be able to get the pubkeys involved in a descriptor (Ava Chow)
ef6745879d key: Add constructor for CExtKey that takes CExtPubKey and CKey (Ava Chow)

Pull request description:

  This PR adds a `createwalletdescriptor` RPC which allows users to add new automatically generated descriptors to their wallet, e.g. to upgrade a 0.21.x wallet to contain a taproot descriptor. This RPC takes 3 arguments: the output type to create a descriptor for, whether the descriptor will be internal or external, and the HD key to use if the user wishes to use a specific key. The HD key is an optional parameter. If it is not specified, the wallet will use the key shared by the active descriptors, if they are all single key. For most users in the expected upgrade scenario, this should be sufficient. In more advanced cases, the user must specify the HD key to use.

  Currently, specified HD keys must already exist in the wallet. To make it easier for the user to know, `gethdkeys` is also added to list out the HD keys in use by all of the descriptors in the wallet. This will include all HD keys, whether we have the private key, for it, which descriptors use it and their activeness, and optionally the extended private key. In this way, users with more complex wallets will be still be able to get HD keys from their wallet for use in other scenarios, and if they want to use `createwalletdescriptor`, they can easily get the keys that they can specify to it.

  See also https://github.com/bitcoin/bitcoin/pull/26728#issuecomment-1866961865

ACKs for top commit:
  Sjors:
    re-utACK 746b6d8839
  furszy:
    ACK 746b6d8
  ryanofsky:
    Code review ACK 746b6d8839, and this looks ready to merge. There were various suggested changes since last review where main change seems to be switching `gethdkeys` output to use normalized descriptors (removing hardened path components).

Tree-SHA512: f2849101e6fbf1f59cb031eaaaee97af5b1ae92aaab54c5716940d210f08ab4fc952df2725b636596cd5747b8f5beb1a7a533425bc10d09da02659473516fbda
2024-03-29 06:39:57 -04:00
..
blockchain.cpp rpc: read raw block in getblock and deserialize for verbosity > 0 2024-03-12 12:47:17 -04:00
blockchain.h refactor: rpc: Pass CBlockIndex by reference instead of pointer 2023-12-07 12:05:21 +01:00
client.cpp Merge bitcoin/bitcoin#29130: wallet: Add createwalletdescriptor and gethdkeys RPCs for adding new automatically generated descriptors 2024-03-29 06:39:57 -04:00
client.h refactor: rpc: hide and rename ParseNonRFCJSONValue() 2023-03-23 18:18:46 +00:00
external_signer.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
fees.cpp refactor: De-globalize g_signals 2024-02-15 14:37:01 +01:00
mempool.cpp scripted-diff: Rename max_sane_feerate to client_maxfeerate 2024-03-25 11:48:18 -04:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp Merge bitcoin/bitcoin#28960: kernel: Remove dependency on CScheduler 2024-03-08 20:58:04 -05:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
net.cpp rpc: "addpeeraddress tried" return error on failure 2024-03-19 17:38:33 +01:00
node.cpp Merge bitcoin/bitcoin#28960: kernel: Remove dependency on CScheduler 2024-03-08 20:58:04 -05:00
output_script.cpp Add PubKeyDestination for P2PK scripts 2023-09-12 12:14:31 -04:00
protocol.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rawtransaction.cpp Merge bitcoin/bitcoin#28890: rpc: Remove deprecated -rpcserialversion 2024-01-05 10:42:10 +00:00
rawtransaction_util.cpp refactor: move parsing to new function 2024-01-19 15:04:56 +01:00
rawtransaction_util.h refactor: move parsing to new function 2024-01-19 15:04:56 +01:00
register.h scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
request.cpp rpc: keep .cookie if it was not generated 2023-11-03 17:29:27 +02:00
request.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
server.h Remove deprecated -rpcserialversion 2023-12-11 18:22:13 +01:00
server_util.cpp refactor: add and use EnsureAnyAddrman in rpc 2023-10-04 08:53:51 +05:30
server_util.h refactor: add and use EnsureAnyAddrman in rpc 2023-10-04 08:53:51 +05:30
signmessage.cpp rpc: Move signmessage RPC util to new file 2022-04-28 11:19:29 +02:00
txoutproof.cpp refactor: Use Txid in CMerkleBlock 2023-11-28 17:49:41 +01:00
util.cpp Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
util.h rpc: Add ParseFeeRate helper 2024-02-15 10:55:47 +01:00