wallet, interfaces: Use BERKELEY_RO in isEncrypted

Since isEncrypted opens a file to search for a particular record, it
needs to use BERKELEY_RO when opening a legacy wallet.
This commit is contained in:
Ava Chow
2025-05-26 14:44:13 -07:00
parent f94167512d
commit 130a922980

View File

@ -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();
}