Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,427 Lines • ▼ Show 20 Lines | bool CWallet::IsHDEnabled() const { | ||||
return result; | return result; | ||||
} | } | ||||
bool CWallet::CanGetAddresses(bool internal) { | bool CWallet::CanGetAddresses(bool internal) { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
if (m_spk_managers.empty()) { | if (m_spk_managers.empty()) { | ||||
return false; | return false; | ||||
} | } | ||||
for (OutputType t : OUTPUT_TYPES) { | auto spk_man = GetScriptPubKeyMan(OutputType::LEGACY, internal); | ||||
auto spk_man = GetScriptPubKeyMan(t, internal); | |||||
if (spk_man && spk_man->CanGetAddresses(internal)) { | if (spk_man && spk_man->CanGetAddresses(internal)) { | ||||
return true; | return true; | ||||
} | } | ||||
} | |||||
return false; | return false; | ||||
} | } | ||||
void CWallet::SetWalletFlag(uint64_t flags) { | void CWallet::SetWalletFlag(uint64_t flags) { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
m_wallet_flags |= flags; | m_wallet_flags |= flags; | ||||
if (!WalletBatch(*database).WriteWalletFlags(m_wallet_flags)) { | if (!WalletBatch(*database).WriteWalletFlags(m_wallet_flags)) { | ||||
throw std::runtime_error(std::string(__func__) + | throw std::runtime_error(std::string(__func__) + | ||||
▲ Show 20 Lines • Show All 3,204 Lines • ▼ Show 20 Lines | bool CWallet::Unlock(const CKeyingMaterial &vMasterKeyIn, bool accept_no_keys) { | ||||
} | } | ||||
NotifyStatusChanged(this); | NotifyStatusChanged(this); | ||||
return true; | return true; | ||||
} | } | ||||
std::set<ScriptPubKeyMan *> CWallet::GetActiveScriptPubKeyMans() const { | std::set<ScriptPubKeyMan *> CWallet::GetActiveScriptPubKeyMans() const { | ||||
std::set<ScriptPubKeyMan *> spk_mans; | std::set<ScriptPubKeyMan *> spk_mans; | ||||
for (bool internal : {false, true}) { | for (bool internal : {false, true}) { | ||||
for (OutputType t : OUTPUT_TYPES) { | auto spk_man = GetScriptPubKeyMan(OutputType::LEGACY, internal); | ||||
auto spk_man = GetScriptPubKeyMan(t, internal); | |||||
if (spk_man) { | if (spk_man) { | ||||
spk_mans.insert(spk_man); | spk_mans.insert(spk_man); | ||||
} | } | ||||
} | } | ||||
} | |||||
return spk_mans; | return spk_mans; | ||||
} | } | ||||
std::set<ScriptPubKeyMan *> CWallet::GetAllScriptPubKeyMans() const { | std::set<ScriptPubKeyMan *> CWallet::GetAllScriptPubKeyMans() const { | ||||
std::set<ScriptPubKeyMan *> spk_mans; | std::set<ScriptPubKeyMan *> spk_mans; | ||||
for (const auto &spk_man_pair : m_spk_managers) { | for (const auto &spk_man_pair : m_spk_managers) { | ||||
spk_mans.insert(spk_man_pair.second.get()); | spk_mans.insert(spk_man_pair.second.get()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
void CWallet::SetupLegacyScriptPubKeyMan() { | void CWallet::SetupLegacyScriptPubKeyMan() { | ||||
if (!m_internal_spk_managers.empty() || !m_external_spk_managers.empty() || | if (!m_internal_spk_managers.empty() || !m_external_spk_managers.empty() || | ||||
!m_spk_managers.empty()) { | !m_spk_managers.empty()) { | ||||
return; | return; | ||||
} | } | ||||
auto spk_manager = | auto spk_manager = | ||||
std::unique_ptr<ScriptPubKeyMan>(new LegacyScriptPubKeyMan(*this)); | std::unique_ptr<ScriptPubKeyMan>(new LegacyScriptPubKeyMan(*this)); | ||||
for (const auto &type : OUTPUT_TYPES) { | const auto type = OutputType::LEGACY; | ||||
m_internal_spk_managers[type] = spk_manager.get(); | m_internal_spk_managers[type] = spk_manager.get(); | ||||
m_external_spk_managers[type] = spk_manager.get(); | m_external_spk_managers[type] = spk_manager.get(); | ||||
} | |||||
m_spk_managers[spk_manager->GetID()] = std::move(spk_manager); | m_spk_managers[spk_manager->GetID()] = std::move(spk_manager); | ||||
} | } | ||||
const CKeyingMaterial &CWallet::GetEncryptionKey() const { | const CKeyingMaterial &CWallet::GetEncryptionKey() const { | ||||
return vMasterKey; | return vMasterKey; | ||||
} | } | ||||
bool CWallet::HasEncryptionKeys() const { | bool CWallet::HasEncryptionKeys() const { | ||||
Show All 10 Lines |