mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
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()
This commit is contained in:
parent
04e442070d
commit
98705aa51c
4 changed files with 14 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue