Skip to content

Commit a42e9df

Browse files
committed
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
1 parent 6e5d3f1 commit a42e9df

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

doc/release-notes-16528.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Descriptor Wallet should be created.
3535

3636
Without those options being set, a Legacy Wallet will be created instead.
3737

38+
3839
#### `IsMine` Semantics
3940

4041
`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.
117118
## RPC changes
118119
- `createwallet` has changed list of arguments: `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )`
119120
`load_on_startup` used to be an argument 5 but now has a number 6.
121+
- `createwallet` requires specifying the `load_on_startup` flag when creating descriptor wallets due to breaking changes in v21.

src/wallet/rpcwallet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,6 +3032,9 @@ static RPCHelpMan createwallet()
30323032
#ifndef USE_SQLITE
30333033
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
30343034
#endif
3035+
if (request.params[6].isNull()) {
3036+
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.");
3037+
}
30353038
flags |= WALLET_FLAG_DESCRIPTORS;
30363039
warnings.emplace_back(Untranslated("Wallet is an experimental descriptor wallet"));
30373040
}

test/functional/test_framework/test_node.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ def __getattr__(self, name):
704704
def createwallet(self, wallet_name, disable_private_keys=None, blank=None, passphrase='', avoid_reuse=None, descriptors=None, load_on_startup=None):
705705
if descriptors is None:
706706
descriptors = self.descriptors
707+
if descriptors is not None and load_on_startup is None:
708+
load_on_startup = False
707709
return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup)
708710

709711
def importprivkey(self, privkey, label=None, rescan=None):

0 commit comments

Comments
 (0)