mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
fix: createwallet to require 'load_on_startup' for descriptor wallets
createwallet has changed list of arguments: createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup ) load_on_startup used to be an argument 5 but now has a number 6. Both arguments 5 and 6 are boolean and it can confuse an user. To prevent confusion if user is not aware about this breaking changes, the RPC createwallet throws an exception if user trying to create descriptor wallet but has not mentioned load_on_startup. This requirement can be removed when major amount of users updated to v21
This commit is contained in:
parent
6e5d3f1d1f
commit
a42e9df06f
@ -35,6 +35,7 @@ Descriptor Wallet should be created.
|
||||
|
||||
Without those options being set, a Legacy Wallet will be created instead.
|
||||
|
||||
|
||||
#### `IsMine` Semantics
|
||||
|
||||
`IsMine` refers to the function used to determine whether a script belongs to the wallet.
|
||||
@ -117,3 +118,4 @@ descriptors with private keys for now as explained earlier.
|
||||
## RPC changes
|
||||
- `createwallet` has changed list of arguments: `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )`
|
||||
`load_on_startup` used to be an argument 5 but now has a number 6.
|
||||
- `createwallet` requires specifying the `load_on_startup` flag when creating descriptor wallets due to breaking changes in v21.
|
||||
|
@ -3032,6 +3032,9 @@ static RPCHelpMan createwallet()
|
||||
#ifndef USE_SQLITE
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
|
||||
#endif
|
||||
if (request.params[6].isNull()) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "The createwallet RPC requires specifying the 'load_on_startup' flag when creating descriptor wallets. Dash Core v21 introduced this requirement due to breaking changes in the createwallet RPC.");
|
||||
}
|
||||
flags |= WALLET_FLAG_DESCRIPTORS;
|
||||
warnings.emplace_back(Untranslated("Wallet is an experimental descriptor wallet"));
|
||||
}
|
||||
|
@ -704,6 +704,8 @@ class RPCOverloadWrapper():
|
||||
def createwallet(self, wallet_name, disable_private_keys=None, blank=None, passphrase='', avoid_reuse=None, descriptors=None, load_on_startup=None):
|
||||
if descriptors is None:
|
||||
descriptors = self.descriptors
|
||||
if descriptors is not None and load_on_startup is None:
|
||||
load_on_startup = False
|
||||
return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup)
|
||||
|
||||
def importprivkey(self, privkey, label=None, rescan=None):
|
||||
|
Loading…
Reference in New Issue
Block a user