MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / isEncrypted

Method isEncrypted

src/wallet/interfaces.cpp:614–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612 return out;
613 }
614 bool isEncrypted(const std::string& wallet_name) override
615 {
616 auto wallets{GetWallets(m_context)};
617 auto it = std::find_if(wallets.begin(), wallets.end(), [&](std::shared_ptr<CWallet> w){ return w->GetName() == wallet_name; });
618 if (it != wallets.end()) return (*it)->HasEncryptionKeys();
619
620 // Unloaded wallet, read db
621 DatabaseOptions options;
622 options.require_existing = true;
623 DatabaseStatus status;
624 bilingual_str error;
625 auto db = MakeWalletDatabase(wallet_name, options, status, error);
626 if (!db && status == wallet::DatabaseStatus::FAILED_LEGACY_DISABLED) {
627 options.require_format = wallet::DatabaseFormat::BERKELEY_RO;
628 db = MakeWalletDatabase(wallet_name, options, status, error);
629 }
630 if (!db) return false;
631 return WalletBatch(*db).IsEncrypted();
632 }
633 std::string getWalletDir() override
634 {
635 return fs::PathToString(GetWalletDir());

Callers 1

do_migrateMethod · 0.80

Calls 8

GetWalletsFunction · 0.85
MakeWalletDatabaseFunction · 0.85
HasEncryptionKeysMethod · 0.80
IsEncryptedMethod · 0.80
WalletBatchClass · 0.70
beginMethod · 0.45
endMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected