diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -5,6 +5,7 @@ This release includes the following features and fixes: +- The `-upgradewallet` command line flag has been replaced in favor of the `upgradewallet` RPC. Updated RPCs ------------ diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -107,8 +107,6 @@ "Spend unconfirmed change when sending transactions (default: %d)", DEFAULT_SPEND_ZEROCONF_CHANGE), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); - gArgs.AddArg("-upgradewallet", "Upgrade wallet to latest format on startup", - ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); gArgs.AddArg("-wallet=", "Specify wallet database path. Can be specified multiple " "times to load multiple wallets. Path is interpreted relative " @@ -217,14 +215,6 @@ } } - if (is_multiwallet) { - if (gArgs.GetBoolArg("-upgradewallet", false)) { - return InitError( - strprintf("%s is only allowed with a single wallet file", - "-upgradewallet")); - } - } - if (gArgs.GetBoolArg("-sysperms", false)) { return InitError("-sysperms is not allowed in combination with enabled " "wallet functionality"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3088,8 +3088,7 @@ "Loads a wallet from a wallet file or directory." "\nNote that all wallet command-line options used when starting " "bitcoind will be" - "\napplied to the new wallet (eg -zapwallettxes, upgradewallet, " - "rescan, etc).\n", + "\napplied to the new wallet (eg -zapwallettxes, rescan, etc).\n", { {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."}, @@ -4534,8 +4533,8 @@ if (!pwallet->CanSupportFeature(FEATURE_HD)) { throw JSONRPCError( RPC_WALLET_ERROR, - "Cannot set a HD seed on a non-HD wallet. Start with " - "-upgradewallet in order to upgrade a non-HD wallet to HD"); + "Cannot set a HD seed on a non-HD wallet. Use the upgradewallet " + "RPC in order to upgrade a non-HD wallet to HD"); } EnsureWalletIsUnlocked(pwallet); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4145,13 +4145,6 @@ } } - if (gArgs.GetBoolArg("-upgradewallet", false)) { - if (!walletInstance->UpgradeWallet(gArgs.GetArg("-upgradewallet", 0), - error, warnings)) { - return nullptr; - } - } - if (fFirstRun) { // Ensure this wallet.dat can only be opened by clients supporting // HD with chain split and expects no default key. @@ -4488,8 +4481,8 @@ max_version >= FEATURE_HD_SPLIT && max_version < FEATURE_PRE_SPLIT_KEYPOOL) { error = _("Cannot upgrade a non HD split wallet without upgrading to " - "support pre split keypool. Please use -upgradewallet=200300 " - "or -upgradewallet with no version specified."); + "support pre split keypool. Please use version 200300 or no " + "version specified."); return false; } diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -171,20 +171,6 @@ '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file") - self.log.info("Do not allow -upgradewallet with multiwallet") - self.nodes[0].assert_start_raises_init_error( - [ - '-upgradewallet', - '-wallet=w1', - '-wallet=w2'], - "Error: -upgradewallet is only allowed with a single wallet file") - self.nodes[0].assert_start_raises_init_error( - [ - '-upgradewallet=1', - '-wallet=w1', - '-wallet=w2'], - "Error: -upgradewallet is only allowed with a single wallet file") - # if wallets/ doesn't exist, datadir should be the default wallet dir wallet_dir2 = data_dir('walletdir') os.rename(wallet_dir(), wallet_dir2) @@ -426,25 +412,6 @@ self.nodes[0].unloadwallet(wallet) self.nodes[1].loadwallet(wallet) - # Fail to load if wallet is downgraded - shutil.copytree( - os.path.join( - self.options.data_wallets_dir, - 'high_minversion'), - wallet_dir('high_minversion')) - self.restart_node( - 0, extra_args=[ - '-upgradewallet={}'.format(FEATURE_LATEST)]) - assert {'name': 'high_minversion'} in self.nodes[0].listwalletdir()[ - 'wallets'] - self.log.info("Fail -upgradewallet that results in downgrade") - assert_raises_rpc_error( - -4, - 'Wallet loading failed. Error loading {}: Wallet requires newer version of {}'.format( - wallet_dir('high_minversion', 'wallet.dat'), self.config['environment']['PACKAGE_NAME']), - lambda: self.nodes[0].loadwallet(filename='high_minversion'), - ) - if __name__ == '__main__': MultiWalletTest().main()