Skip to content

Commit

Permalink
chore: postpone breaking changes of wallet_upgradewallet to v21
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Jan 31, 2024
1 parent 7d1b571 commit cf03c33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4897,8 +4897,8 @@ bool CWallet::UpgradeWallet(int version, bilingual_str& error)
return false;
}

// Discourage users to skip passphrase for HD wallets
if (nMaxVersion >= FEATURE_HD && !IsHDEnabled()) {
// TODO: consider discourage users to skip passphrase for HD wallets for v21
if (false && nMaxVersion >= FEATURE_HD && !IsHDEnabled()) {
error = Untranslated("You should use upgradetohd RPC to upgrade non-HD wallet to HD");
return false;
}
Expand Down
11 changes: 6 additions & 5 deletions test/functional/wallet_upgradewallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_greater_than,
assert_greater_than_or_equal,
assert_is_hex_string,
assert_raises_rpc_error,
)


Expand Down Expand Up @@ -127,14 +127,15 @@ def run_test(self):
assert_equal('hdseedid' in wallet.getwalletinfo(), False)
# calling upgradewallet with explicit version number
# should return nothing if successful
assert_raises_rpc_error(-4, "You should use upgradetohd RPC to upgrade non-HD wallet to HD", wallet.upgradewallet, 120200)
assert_equal(wallet.upgradewallet(120200), "")

new_version = wallet.getwalletinfo()["walletversion"]
# upgraded wallet would not have 120200 version until HD seed actually appeared
assert_greater_than(120200, new_version)
# after conversion master key hash should not be present yet
assert 'hdchainid' not in wallet.getwalletinfo()

assert_equal(wallet.upgradetohd(), True)
new_version = wallet.getwalletinfo()["walletversion"]
# after conversion master key hash should not be present yet
assert 'hdchainid' in wallet.getwalletinfo()
assert_equal(new_version, 120200)
assert_is_hex_string(wallet.getwalletinfo()['hdchainid'])

Expand Down

0 comments on commit cf03c33

Please sign in to comment.