btcd icon indicating copy to clipboard operation
btcd copied to clipboard

Add 'descriptors' argument to CreateWalletCmd struct

Open Luisfc68 opened this issue 1 year ago • 1 comments

Currently the CreateWalletCmd struct only supports the wallet_name, disable_private_keys, blank, passphrase and avoid_reuse arguments to set when executing the createwallet RPC command, but the descriptors argument cannot be specified. After the version 23.0.0 of the bitcoin core RPC this argument became true by default and since the importdescriptors RPC command is not implemented, this can lead to situations like the following when using this project to interact with RPC server:

I need to create a watch-only wallet and import a public key to track the transactions related to it so:

  1. I create a wallet using
_, err := client.CreateWallet(
		walletId,
		rpcclient.WithCreateWalletDisablePrivateKeys(),
		rpcclient.WithCreateWalletBlank(),
	)
  1. This wallet is created as native descriptor wallet since the descriptors argument is defaulted as true and I can't change it
  2. I try to use err = client.ImportPubKeyRescan(pubKey, true) but it gives an error since this command is not supported by non-legacy wallets
  3. I can't use importdescriptors neither since its not implemented
  4. I can't import the public key to this wallet in any way

Is there any chance that the descriptors field can be added to the CreateWalletCmd struct so that argument can be specified when using this project? Are you accepting PRs to do so?

Please tell me if I'm missing something. Thanks in advance.

Luisfc68 avatar Apr 27 '24 21:04 Luisfc68

In order to add that field, you'd need to implement descriptors first: https://github.com/btcsuite/btcd/issues/2137. We'd accept a PR doing so.

Roasbeef avatar Apr 29 '24 18:04 Roasbeef