diff --git a/src/script/ismine.cpp b/src/script/ismine.cpp index 72c730c9c9..bbc333454e 100644 --- a/src/script/ismine.cpp +++ b/src/script/ismine.cpp @@ -13,16 +13,13 @@ typedef std::vector valtype; -unsigned int HaveKeys(const std::vector& pubkeys, const CKeyStore& keystore) +static bool HaveKeys(const std::vector& pubkeys, const CKeyStore& keystore) { - unsigned int nResult = 0; - for (const valtype& pubkey : pubkeys) - { + for (const valtype& pubkey : pubkeys) { CKeyID keyID = CPubKey(pubkey).GetID(); - if (keystore.HaveKey(keyID)) - ++nResult; + if (!keystore.HaveKey(keyID)) return false; } - return nResult; + return true; } isminetype IsMine(const CKeyStore &keystore, const CTxDestination& dest) @@ -76,7 +73,7 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) // them) enable spend-out-from-under-you attacks, especially // in shared-wallet situations. std::vector keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1); - if (HaveKeys(keys, keystore) == keys.size()) + if (HaveKeys(keys, keystore)) return ISMINE_SPENDABLE; break; }