|
|
|
@ -4245,6 +4245,45 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static UniValue upgradewallet(const JSONRPCRequest& request)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
|
|
|
|
CWallet* const pwallet = wallet.get();
|
|
|
|
|
|
|
|
|
|
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
|
|
|
|
|
return NullUniValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RPCHelpMan{"upgradewallet",
|
|
|
|
|
"\nUpgrade the wallet. Upgrades to the latest version if no version number is specified\n"
|
|
|
|
|
"New keys may be generated and a new wallet backup will need to be made.",
|
|
|
|
|
{
|
|
|
|
|
{"version", RPCArg::Type::NUM, /* default */ strprintf("%d", FEATURE_LATEST), "The version number to upgrade to. Default is the latest wallet version"}
|
|
|
|
|
},
|
|
|
|
|
RPCResults{},
|
|
|
|
|
RPCExamples{
|
|
|
|
|
HelpExampleCli("upgradewallet", "169900")
|
|
|
|
|
+ HelpExampleRpc("upgradewallet", "169900")
|
|
|
|
|
}
|
|
|
|
|
}.Check(request);
|
|
|
|
|
|
|
|
|
|
RPCTypeCheck(request.params, {UniValue::VNUM}, true);
|
|
|
|
|
|
|
|
|
|
EnsureWalletIsUnlocked(pwallet);
|
|
|
|
|
|
|
|
|
|
int version = 0;
|
|
|
|
|
if (!request.params[0].isNull()) {
|
|
|
|
|
version = request.params[0].get_int();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string error;
|
|
|
|
|
std::vector<std::string> warnings;
|
|
|
|
|
if (!pwallet->UpgradeWallet(version, error, warnings)) {
|
|
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, error);
|
|
|
|
|
}
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp
|
|
|
|
|
UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp
|
|
|
|
|
UniValue importprivkey(const JSONRPCRequest& request);
|
|
|
|
@ -4313,6 +4352,7 @@ static const CRPCCommand commands[] =
|
|
|
|
|
{ "wallet", "signmessage", &signmessage, {"address","message"} },
|
|
|
|
|
{ "wallet", "signrawtransactionwithwallet", &signrawtransactionwithwallet, {"hexstring","prevtxs","sighashtype"} },
|
|
|
|
|
{ "wallet", "unloadwallet", &unloadwallet, {"wallet_name"} },
|
|
|
|
|
{ "wallet", "upgradewallet", &upgradewallet, {"version"} },
|
|
|
|
|
{ "wallet", "walletcreatefundedpsbt", &walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} },
|
|
|
|
|
{ "wallet", "walletlock", &walletlock, {} },
|
|
|
|
|
{ "wallet", "walletpassphrase", &walletpassphrase, {"passphrase","timeout"} },
|
|
|
|
|