From 98705aa51cbfee81ecd2498a014c285ac677ba69 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 19 Jun 2011 18:32:36 +0200 Subject: Bugfixes walletclass Some problems found by ius: * compiler complains with no return after critical section block * CKeyStore::GetPrivKey(key) was undefined for unknown key * missing return statement in GetChange() --- src/script.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/script.cpp') diff --git a/src/script.cpp b/src/script.cpp index e1b5ae895..bd1b5b3c5 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1038,12 +1038,13 @@ bool Solver(const CKeyStore& keystore, const CScript& scriptPubKey, uint256 hash { // Sign const valtype& vchPubKey = item.second; - if (!keystore.HaveKey(vchPubKey)) + CPrivKey privkey; + if (!keystore.GetPrivKey(vchPubKey, privkey)) return false; if (hash != 0) { vector vchSig; - if (!CKey::Sign(keystore.GetPrivKey(vchPubKey), hash, vchSig)) + if (!CKey::Sign(privkey, hash, vchSig)) return false; vchSig.push_back((unsigned char)nHashType); scriptSigRet << vchSig; @@ -1056,12 +1057,13 @@ bool Solver(const CKeyStore& keystore, const CScript& scriptPubKey, uint256 hash if (mi == mapPubKeys.end()) return false; const vector& vchPubKey = (*mi).second; - if (!keystore.HaveKey(vchPubKey)) + CPrivKey privkey; + if (!keystore.GetPrivKey(vchPubKey, privkey)) return false; if (hash != 0) { vector vchSig; - if (!CKey::Sign(keystore.GetPrivKey(vchPubKey), hash, vchSig)) + if (!CKey::Sign(privkey, hash, vchSig)) return false; vchSig.push_back((unsigned char)nHashType); scriptSigRet << vchSig << vchPubKey; -- cgit v1.2.3