diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2011-06-19 18:32:36 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2011-06-20 20:07:28 +0200 |
commit | 98705aa51cbfee81ecd2498a014c285ac677ba69 (patch) | |
tree | dcd42eff69a50111b29f7bdb7cad396dd49c6b7b /src/script.cpp | |
parent | 04e442070d3db1abb761d3e04d80d6ece6d5602b (diff) |
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()
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/script.cpp b/src/script.cpp index e1b5ae8959..bd1b5b3c5f 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<unsigned char> 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<unsigned char>& vchPubKey = (*mi).second; - if (!keystore.HaveKey(vchPubKey)) + CPrivKey privkey; + if (!keystore.GetPrivKey(vchPubKey, privkey)) return false; if (hash != 0) { vector<unsigned char> 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; |