diff options
author | Samuel Dobson <dobsonsa68@gmail.com> | 2021-08-22 12:48:12 +1200 |
---|---|---|
committer | Samuel Dobson <dobsonsa68@gmail.com> | 2021-08-22 13:18:44 +1200 |
commit | 3755dea3c502f32048b110a4868daefe9dbe3cc1 (patch) | |
tree | ae724fe57020e509aeecc8c2c8cce6d3ba7d94ec | |
parent | eb09c26724e3f714b613788fc506f2ff3a208d2c (diff) | |
parent | 8733a8e84c4b2e484f6ed6159fcf5f29a360d42e (diff) |
Merge bitcoin/bitcoin#22781: wallet: fix the behavior of IsHDEnabled, return false in case of a blank hd wallet.
8733a8e84c4b2e484f6ed6159fcf5f29a360d42e the result of CWallet::IsHDEnabled() was initialized with true. (Saibato)
Pull request description:
the result of CWallet::IsHDEnabled() was initialized with true.
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.
ACKs for top commit:
achow101:
ACK 8733a8e84c4b2e484f6ed6159fcf5f29a360d42e
hebasto:
ACK 8733a8e84c4b2e484f6ed6159fcf5f29a360d42e
theStack:
utACK 8733a8e84c4b2e484f6ed6159fcf5f29a360d42e
meshcollider:
utACK 8733a8e84c4b2e484f6ed6159fcf5f29a360d42e
Tree-SHA512: 79b976594f7174d05c29fe3819037ead59aaef27498d95415ceba74d633a8e035f6b03b521000ac3370684a8cb09319d8be1a443ce2d29b3ff4089e399f6b719
-rw-r--r-- | src/wallet/wallet.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index dbcfc4dac3..6fcede07dc 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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; } |