Skip to content

Commit

Permalink
Implement IsHDEnabled in DescriptorScriptPubKeyMan
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Apr 23, 2020
1 parent 741122d commit ec2f9e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,8 @@ void DescriptorScriptPubKeyMan::MarkUnusedAddresses(const CScript& script)

bool DescriptorScriptPubKeyMan::IsHDEnabled() const
{
return false;
LOCK(cs_desc_man);
return m_wallet_descriptor.descriptor->IsRange();
}

bool DescriptorScriptPubKeyMan::CanGetAddresses(bool internal) const
Expand Down
5 changes: 3 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,10 @@ CAmount CWallet::GetChange(const CTransaction& tx) const

bool CWallet::IsHDEnabled() const
{
// All Active ScriptPubKeyMans must be HD for this to be true
bool result = true;
for (const auto& spk_man_pair : m_spk_managers) {
result &= spk_man_pair.second->IsHDEnabled();
for (const auto& spk_man : GetActiveScriptPubKeyMans()) {
result &= spk_man->IsHDEnabled();
}
return result;
}
Expand Down

0 comments on commit ec2f9e1

Please sign in to comment.