Skip to content

Commit 0d32d66

Browse files
committed
Remove -upgradewallet startup option
1 parent 92263cc commit 0d32d66

File tree

4 files changed

+3
-33
lines changed

4 files changed

+3
-33
lines changed

src/wallet/init.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ void WalletInit::AddWalletOptions() const
5757
gArgs.AddArg("-salvagewallet", "Attempt to recover private keys from a corrupt wallet on startup", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
5858
gArgs.AddArg("-spendzeroconfchange", strprintf("Spend unconfirmed change when sending transactions (default: %u)", DEFAULT_SPEND_ZEROCONF_CHANGE), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
5959
gArgs.AddArg("-txconfirmtarget=<n>", strprintf("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)", DEFAULT_TX_CONFIRM_TARGET), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
60-
gArgs.AddArg("-upgradewallet", "Upgrade wallet to latest format on startup", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6160
gArgs.AddArg("-wallet=<path>", "Specify wallet database path. Can be specified multiple times to load multiple wallets. Path is interpreted relative to <walletdir> if it is not absolute, and will be created if it does not exist (as a directory containing a wallet.dat file and log files). For backwards compatibility this will also accept names of existing data files in <walletdir>.)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET);
6261
gArgs.AddArg("-walletbroadcast", strprintf("Make the wallet broadcast transactions (default: %u)", DEFAULT_WALLETBROADCAST), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6362
gArgs.AddArg("-walletdir=<dir>", "Specify directory to hold wallets (default: <datadir>/wallets if it exists, otherwise <datadir>)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET);
@@ -116,12 +115,6 @@ bool WalletInit::ParameterInteraction() const
116115
}
117116
}
118117

119-
if (is_multiwallet) {
120-
if (gArgs.GetBoolArg("-upgradewallet", false)) {
121-
return InitError(strprintf("%s is only allowed with a single wallet file", "-upgradewallet"));
122-
}
123-
}
124-
125118
if (gArgs.GetBoolArg("-sysperms", false))
126119
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
127120

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ static UniValue loadwallet(const JSONRPCRequest& request)
25862586
RPCHelpMan{"loadwallet",
25872587
"\nLoads a wallet from a wallet file or directory."
25882588
"\nNote that all wallet command-line options used when starting bitcoind will be"
2589-
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n",
2589+
"\napplied to the new wallet (eg -zapwallettxes, rescan, etc).\n",
25902590
{
25912591
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
25922592
},
@@ -4021,7 +4021,7 @@ UniValue sethdseed(const JSONRPCRequest& request)
40214021

40224022
// Do not do anything to non-HD wallets
40234023
if (!pwallet->CanSupportFeature(FEATURE_HD)) {
4024-
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");
4024+
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot set a HD seed on a non-HD wallet. Use the upgradewallet RPC in order to upgrade a non-HD wallet to HD");
40254025
}
40264026

40274027
EnsureWalletIsUnlocked(pwallet);

src/wallet/wallet.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3830,12 +3830,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
38303830
}
38313831
}
38323832

3833-
if (gArgs.GetBoolArg("-upgradewallet", false)) {
3834-
if (!UpgradeWallet(gArgs.GetBoolArg("-upgradewallet", 0), error, warnings)) {
3835-
return nullptr;
3836-
}
3837-
}
3838-
38393833
if (fFirstRun)
38403834
{
38413835
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
@@ -4121,7 +4115,7 @@ bool CWallet::UpgradeWallet(int version, std::string& error, std::vector<std::st
41214115
// Do not upgrade versions to any version between HD_SPLIT and FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT
41224116
int max_version = GetVersion();
41234117
if (!CanSupportFeature(FEATURE_HD_SPLIT) && max_version >= FEATURE_HD_SPLIT && max_version < FEATURE_PRE_SPLIT_KEYPOOL) {
4124-
error = _("Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified.").translated;
4118+
error = _("Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use version 169900 or no version specified.").translated;
41254119
return false;
41264120
}
41274121

test/functional/wallet_multiwallet.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ def wallet_file(name):
125125
self.nodes[0].assert_start_raises_init_error(['-salvagewallet', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
126126
self.nodes[0].assert_start_raises_init_error(['-salvagewallet=1', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
127127

128-
self.log.info("Do not allow -upgradewallet with multiwallet")
129-
self.nodes[0].assert_start_raises_init_error(['-upgradewallet', '-wallet=w1', '-wallet=w2'], "Error: -upgradewallet is only allowed with a single wallet file")
130-
self.nodes[0].assert_start_raises_init_error(['-upgradewallet=1', '-wallet=w1', '-wallet=w2'], "Error: -upgradewallet is only allowed with a single wallet file")
131-
132128
# if wallets/ doesn't exist, datadir should be the default wallet dir
133129
wallet_dir2 = data_dir('walletdir')
134130
os.rename(wallet_dir(), wallet_dir2)
@@ -332,18 +328,5 @@ def wallet_file(name):
332328
self.nodes[0].unloadwallet(wallet)
333329
self.nodes[1].loadwallet(wallet)
334330

335-
# Fail to load if wallet is downgraded
336-
shutil.copytree(os.path.join(self.options.data_wallets_dir, 'high_minversion'), wallet_dir('high_minversion'))
337-
self.restart_node(0, extra_args=['-upgradewallet={}'.format(FEATURE_LATEST)])
338-
assert {'name': 'high_minversion'} in self.nodes[0].listwalletdir()['wallets']
339-
self.log.info("Fail -upgradewallet that results in downgrade")
340-
assert_raises_rpc_error(
341-
-4,
342-
'Wallet loading failed: Error loading {}: Wallet requires newer version of {}'.format(
343-
wallet_dir('high_minversion', 'wallet.dat'), self.config['environment']['PACKAGE_NAME']),
344-
lambda: self.nodes[0].loadwallet(filename='high_minversion'),
345-
)
346-
347-
348331
if __name__ == '__main__':
349332
MultiWalletTest().main()

0 commit comments

Comments
 (0)