Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.cpp
Show First 20 Lines • Show All 1,574 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool DescriptorScriptPubKeyMan::IsHDEnabled() const { | bool DescriptorScriptPubKeyMan::IsHDEnabled() const { | ||||
LOCK(cs_desc_man); | LOCK(cs_desc_man); | ||||
return m_wallet_descriptor.descriptor->IsRange(); | return m_wallet_descriptor.descriptor->IsRange(); | ||||
} | } | ||||
bool DescriptorScriptPubKeyMan::CanGetAddresses(bool internal) const { | bool DescriptorScriptPubKeyMan::CanGetAddresses(bool internal) const { | ||||
return false; | // We can only give out addresses from descriptors that are single type (not | ||||
// combo), ranged, and either have cached keys or can generate more keys | |||||
// (ignoring encryption) | |||||
LOCK(cs_desc_man); | |||||
return m_wallet_descriptor.descriptor->IsSingleType() && | |||||
m_wallet_descriptor.descriptor->IsRange() && | |||||
(HavePrivateKeys() || | |||||
m_wallet_descriptor.next_index < m_wallet_descriptor.range_end); | |||||
} | } | ||||
bool DescriptorScriptPubKeyMan::HavePrivateKeys() const { | bool DescriptorScriptPubKeyMan::HavePrivateKeys() const { | ||||
return false; | LOCK(cs_desc_man); | ||||
return m_map_keys.size() > 0 || m_map_crypted_keys.size() > 0; | |||||
} | } | ||||
int64_t DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const { | int64_t DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const { | ||||
return GetTime(); | return GetTime(); | ||||
} | } | ||||
size_t DescriptorScriptPubKeyMan::KeypoolCountExternalKeys() const { | size_t DescriptorScriptPubKeyMan::KeypoolCountExternalKeys() const { | ||||
if (m_internal) { | |||||
return 0; | return 0; | ||||
} | } | ||||
return GetKeyPoolSize(); | |||||
} | |||||
unsigned int DescriptorScriptPubKeyMan::GetKeyPoolSize() const { | unsigned int DescriptorScriptPubKeyMan::GetKeyPoolSize() const { | ||||
return 0; | LOCK(cs_desc_man); | ||||
return m_wallet_descriptor.range_end - m_wallet_descriptor.next_index; | |||||
} | } | ||||
int64_t DescriptorScriptPubKeyMan::GetTimeFirstKey() const { | int64_t DescriptorScriptPubKeyMan::GetTimeFirstKey() const { | ||||
return 0; | LOCK(cs_desc_man); | ||||
return m_wallet_descriptor.creation_time; | |||||
} | } | ||||
std::unique_ptr<SigningProvider> | std::unique_ptr<SigningProvider> | ||||
DescriptorScriptPubKeyMan::GetSolvingProvider(const CScript &script) const { | DescriptorScriptPubKeyMan::GetSolvingProvider(const CScript &script) const { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
bool DescriptorScriptPubKeyMan::CanProvide(const CScript &script, | bool DescriptorScriptPubKeyMan::CanProvide(const CScript &script, | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |