diff --git a/doc/release-notes-16528.md b/doc/release-notes-16528.md index 84af219e90ba..981ca058e435 100644 --- a/doc/release-notes-16528.md +++ b/doc/release-notes-16528.md @@ -115,5 +115,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` has a new argument `descriptors` at number 6: `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse load_on_startup descriptors )` diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 510ce0443e20..95e03f070a23 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -213,8 +213,8 @@ static const CRPCConvertParam vRPCConvertParams[] = { "createwallet", 1, "disable_private_keys"}, { "createwallet", 2, "blank"}, { "createwallet", 4, "avoid_reuse"}, - { "createwallet", 5, "descriptors"}, - { "createwallet", 6, "load_on_startup"}, + { "createwallet", 5, "load_on_startup"}, + { "createwallet", 6, "descriptors"}, { "loadwallet", 1, "load_on_startup"}, { "unloadwallet", 1, "load_on_startup"}, { "upgradetohd", 3, "rescan"}, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6b3986ef3ff4..9f045255bb0b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2977,8 +2977,9 @@ static RPCHelpMan createwallet() {"blank", RPCArg::Type::BOOL, /* default */ "false", "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using upgradetohd (by mnemonic) or sethdseed (WIF private key)."}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Encrypt the wallet with this passphrase."}, {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "false", "Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."}, - {"descriptors", RPCArg::Type::BOOL, /* default */ "false", "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation"}, + // Note that order is different with bitcoin, it is intentionally to avoid confusing unexpected breaking changes between v20 and v21 due to `load_on_startup` being backported in prior of descriptor wallets. {"load_on_startup", RPCArg::Type::BOOL, /* default */ "null", "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."}, + {"descriptors", RPCArg::Type::BOOL, /* default */ "false", "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation"}, }, RPCResult{ RPCResult::Type::OBJ, "", "", @@ -3018,7 +3019,7 @@ static RPCHelpMan createwallet() if (!request.params[4].isNull() && request.params[4].get_bool()) { flags |= WALLET_FLAG_AVOID_REUSE; } - if (!request.params[5].isNull() && request.params[5].get_bool()) { + if (!request.params[6].isNull() && request.params[6].get_bool()) { #ifndef USE_SQLITE throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)"); #endif @@ -3037,7 +3038,7 @@ static RPCHelpMan createwallet() options.create_flags = flags; options.create_passphrase = passphrase; bilingual_str error; - std::optional load_on_start = request.params[6].isNull() ? std::nullopt : std::optional(request.params[6].get_bool()); + std::optional load_on_start = request.params[5].isNull() ? std::nullopt : std::optional(request.params[5].get_bool()); std::shared_ptr wallet = CreateWallet(*context.chain, *context.m_coinjoin_loader, request.params[0].get_str(), load_on_start, options, status, error, warnings); if (!wallet) { RPCErrorCode code = status == DatabaseStatus::FAILED_ENCRYPT ? RPC_WALLET_ENCRYPTION_FAILED : RPC_WALLET_ERROR; @@ -4629,7 +4630,7 @@ static const CRPCCommand commands[] = { "wallet", "abortrescan", &abortrescan, {} }, { "wallet", "addmultisigaddress", &addmultisigaddress, {"nrequired","keys","label"} }, { "wallet", "backupwallet", &backupwallet, {"destination"} }, - { "wallet", "createwallet", &createwallet, {"wallet_name", "disable_private_keys", "blank", "passphrase", "avoid_reuse", "descriptors", "load_on_startup"} }, + { "wallet", "createwallet", &createwallet, {"wallet_name", "disable_private_keys", "blank", "passphrase", "avoid_reuse", "load_on_startup", "descriptors"} }, { "wallet", "dumphdinfo", &dumphdinfo, {} }, { "wallet", "dumpprivkey", &dumpprivkey, {"address"} }, { "wallet", "dumpwallet", &dumpwallet, {"filename"} }, diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 5c9c084de645..a82e4c5bd57b 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -705,7 +705,7 @@ def __getattr__(self, name): 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 - return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup) + return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, load_on_startup, descriptors) def importprivkey(self, privkey, label=None, rescan=None): wallet_info = self.getwalletinfo()