Skip to content

Commit ecf3baf

Browse files
committed
Merge bitcoin/bitcoin#27869: wallet: Give deprecation warning when loading a legacy wallet
8fbb6e9 wallet: Give deprecation warning when loading a legacy wallet (Andrew Chow) Pull request description: Next step in legacy wallet deprecation. ACKs for top commit: S3RK: reACK 8fbb6e9 jonatack: re-ACK 8fbb6e9 Tree-SHA512: 902984b09452926cf199f06e5fb56e4985325cdd5e0dcc829992158488f42d5fbc33e9a30a29303feac24c8315193e8d31712022e2a0503abd6b67169a0027f4
2 parents bc4f6b1 + 8fbb6e9 commit ecf3baf

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/wallet/wallet.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ std::shared_ptr<CWallet> LoadWalletInternal(WalletContext& context, const std::s
245245
return nullptr;
246246
}
247247

248+
// Legacy wallets are being deprecated, warn if the loaded wallet is legacy
249+
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
250+
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."));
251+
}
252+
248253
NotifyWalletLoaded(context, wallet);
249254
AddWallet(context, wallet);
250255
wallet->postInitProcess();

test/functional/wallet_backwards_compatibility.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,11 @@ def run_test(self):
264264
os.path.join(node_master_wallets_dir, "u1_v16")
265265
)
266266
load_res = node_master.loadwallet("u1_v16")
267-
# Make sure this wallet opens without warnings. See https://github.com/bitcoin/bitcoin/pull/19054
267+
# Make sure this wallet opens with only the migration warning. See https://github.com/bitcoin/bitcoin/pull/19054
268268
if int(node_master.getnetworkinfo()["version"]) >= 249900:
269269
# loadwallet#warnings (added in v25) -- only present if there is a warning
270-
assert "warnings" not in load_res
270+
# Legacy wallets will have only a deprecation warning
271+
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."])
271272
else:
272273
# loadwallet#warning (deprecated in v25) -- always present, but empty string if no warning
273274
assert_equal(load_res["warning"], '')

0 commit comments

Comments
 (0)