mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-12 23:37:00 +02:00
Merge bitcoin/bitcoin#32620: wallet: Fix wallet interface detection of encrypted wallets
130a922980
wallet, interfaces: Use BERKELEY_RO in isEncrypted (Ava Chow) Pull request description: The GUI uses `WalletLoader::isEncrypted()` to detect whether a wallet file is encrypted so that it knows whether to prompt for a passphrase when migrating a legacy wallet. However, legacy wallets need to be opened with `options.require_format = BERKELEY_RO`. Since this wasn't being provided, following #28710, encrypted legacy wallets could not be migrated. This fixes the issue by detecting when a wallet file is for a legacy wallet, and re-attempting with `options.require_format = BERKELEY_RO` in that case. Depends on #32449 for `DatabaseStatus::FAILED_LEGACY_DISABLED` ACKs for top commit: davidgumberg: Tested ACK130a922980
furszy: utACK130a922980
pablomartin4btc: tACK130a922980
w0xlt: Code review ACK130a922980
rkrux: utACK130a922980
Tree-SHA512: aa70defc3b5f41635333a4d83c46ecdb5cd3cb129d590b4c0fe7a5f16e8aeaba1592f932ead242ed5f84524b146d87319154f4a1820bb34d9e80f63d24fc6b20
This commit is contained in:
@ -643,6 +643,10 @@ public:
|
||||
DatabaseStatus status;
|
||||
bilingual_str error;
|
||||
auto db = MakeWalletDatabase(wallet_name, options, status, error);
|
||||
if (!db && status == wallet::DatabaseStatus::FAILED_LEGACY_DISABLED) {
|
||||
options.require_format = wallet::DatabaseFormat::BERKELEY_RO;
|
||||
db = MakeWalletDatabase(wallet_name, options, status, error);
|
||||
}
|
||||
if (!db) return false;
|
||||
return WalletBatch(*db).IsEncrypted();
|
||||
}
|
||||
|
Reference in New Issue
Block a user