aboutsummaryrefslogtreecommitdiff
path: root/src/script/ismine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/ismine.cpp')
-rw-r--r--src/script/ismine.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/script/ismine.cpp b/src/script/ismine.cpp
index 5849f55651..35d794b983 100644
--- a/src/script/ismine.cpp
+++ b/src/script/ismine.cpp
@@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2016 The Bitcoin Core developers
+// Copyright (c) 2009-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -13,16 +13,13 @@
typedef std::vector<unsigned char> valtype;
-unsigned int HaveKeys(const std::vector<valtype>& pubkeys, const CKeyStore& keystore)
+static bool HaveKeys(const std::vector<valtype>& 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 CScript& scriptPubKey, SigVersion sigversion)
@@ -140,7 +137,7 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey, bool&
}
}
}
- if (HaveKeys(keys, keystore) == keys.size())
+ if (HaveKeys(keys, keystore))
return ISMINE_SPENDABLE;
break;
}