mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
wallet: Give deprecation warning when loading a legacy wallet
This commit is contained in:
parent
c92fd63886
commit
8fbb6e99bf
2 changed files with 8 additions and 2 deletions
|
@ -245,6 +245,11 @@ std::shared_ptr<CWallet> LoadWalletInternal(WalletContext& context, const std::s
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy wallets are being deprecated, warn if the loaded wallet is legacy
|
||||||
|
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
|
||||||
|
warnings.push_back(_("Wallet loaded successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future. Legacy wallets can be migrated to a descriptor wallet with migratewallet."));
|
||||||
|
}
|
||||||
|
|
||||||
NotifyWalletLoaded(context, wallet);
|
NotifyWalletLoaded(context, wallet);
|
||||||
AddWallet(context, wallet);
|
AddWallet(context, wallet);
|
||||||
wallet->postInitProcess();
|
wallet->postInitProcess();
|
||||||
|
|
|
@ -264,10 +264,11 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
os.path.join(node_master_wallets_dir, "u1_v16")
|
os.path.join(node_master_wallets_dir, "u1_v16")
|
||||||
)
|
)
|
||||||
load_res = node_master.loadwallet("u1_v16")
|
load_res = node_master.loadwallet("u1_v16")
|
||||||
# Make sure this wallet opens without warnings. See https://github.com/bitcoin/bitcoin/pull/19054
|
# Make sure this wallet opens with only the migration warning. See https://github.com/bitcoin/bitcoin/pull/19054
|
||||||
if int(node_master.getnetworkinfo()["version"]) >= 249900:
|
if int(node_master.getnetworkinfo()["version"]) >= 249900:
|
||||||
# loadwallet#warnings (added in v25) -- only present if there is a warning
|
# loadwallet#warnings (added in v25) -- only present if there is a warning
|
||||||
assert "warnings" not in load_res
|
# Legacy wallets will have only a deprecation warning
|
||||||
|
assert_equal(load_res["warnings"], ["Wallet loaded successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future. Legacy wallets can be migrated to a descriptor wallet with migratewallet."])
|
||||||
else:
|
else:
|
||||||
# loadwallet#warning (deprecated in v25) -- always present, but empty string if no warning
|
# loadwallet#warning (deprecated in v25) -- always present, but empty string if no warning
|
||||||
assert_equal(load_res["warning"], '')
|
assert_equal(load_res["warning"], '')
|
||||||
|
|
Loading…
Add table
Reference in a new issue