Skip to content

Commit

Permalink
the result of CWallet::IsHDEnabled() was initialized with true.
Browse files Browse the repository at this point in the history
But in case of no keys or a blank hd wallet the iterator would be skipped
and not set to false but true, since the loop would be not entered.

That had resulted in a wrong return and subsequent false HD and watch-only
icon display in gui when reloading a wallet after closing.

Update src/wallet/wallet.cpp

Co-authored-by: Hennadii Stepanov <[email protected]>
  • Loading branch information
Saibato and hebasto committed Aug 24, 2021
1 parent eb09c26 commit 8733a8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,10 @@ CAmount CWallet::GetDebit(const CTransaction& tx, const isminefilter& filter) co
bool CWallet::IsHDEnabled() const
{
// All Active ScriptPubKeyMans must be HD for this to be true
bool result = true;
bool result = false;
for (const auto& spk_man : GetActiveScriptPubKeyMans()) {
result &= spk_man->IsHDEnabled();
if (!spk_man->IsHDEnabled()) return false;
result = true;
}
return result;
}
Expand Down

0 comments on commit 8733a8e

Please sign in to comment.