Skip to content

Commit fd74d60

Browse files
committed
Merge bitcoin/bitcoin#32620: wallet: Fix wallet interface detection of encrypted wallets
130a922 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 ACK bitcoin/bitcoin@130a922 furszy: utACK 130a922 pablomartin4btc: tACK 130a922 w0xlt: Code review ACK bitcoin/bitcoin@130a922 rkrux: utACK 130a922 Tree-SHA512: aa70defc3b5f41635333a4d83c46ecdb5cd3cb129d590b4c0fe7a5f16e8aeaba1592f932ead242ed5f84524b146d87319154f4a1820bb34d9e80f63d24fc6b20
2 parents 65b2650 + 130a922 commit fd74d60

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/wallet/interfaces.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,10 @@ class WalletLoaderImpl : public WalletLoader
643643
DatabaseStatus status;
644644
bilingual_str error;
645645
auto db = MakeWalletDatabase(wallet_name, options, status, error);
646+
if (!db && status == wallet::DatabaseStatus::FAILED_LEGACY_DISABLED) {
647+
options.require_format = wallet::DatabaseFormat::BERKELEY_RO;
648+
db = MakeWalletDatabase(wallet_name, options, status, error);
649+
}
646650
if (!db) return false;
647651
return WalletBatch(*db).IsEncrypted();
648652
}

0 commit comments

Comments
 (0)