|
|
@ -1122,31 +1122,38 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// requires either keystore==0, or a lock on keystore->cs_KeyStore
|
|
|
|
bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* keystore, CBitcoinAddress& addressRet) |
|
|
|
bool static ExtractAddressInner(const CScript& scriptPubKey, const CKeyStore* keystore, CBitcoinAddress& addressRet) |
|
|
|
{ |
|
|
|
{ |
|
|
|
vector<pair<opcodetype, valtype> > vSolution; |
|
|
|
vector<pair<opcodetype, valtype> > vSolution; |
|
|
|
if (!Solver(scriptPubKey, vSolution)) |
|
|
|
if (!Solver(scriptPubKey, vSolution)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
CRITICAL_BLOCK(keystore->cs_KeyStore) |
|
|
|
BOOST_FOREACH(PAIRTYPE(opcodetype, valtype)& item, vSolution) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH(PAIRTYPE(opcodetype, valtype)& item, vSolution) |
|
|
|
if (item.first == OP_PUBKEY) |
|
|
|
{ |
|
|
|
addressRet.SetPubKey(item.second); |
|
|
|
uint160 hash160; |
|
|
|
else if (item.first == OP_PUBKEYHASH) |
|
|
|
if (item.first == OP_PUBKEY) |
|
|
|
addressRet.SetHash160((uint160)item.second); |
|
|
|
addressRet.SetPubKey(item.second); |
|
|
|
if (keystore == NULL || keystore->HaveKey(addressRet)) |
|
|
|
else if (item.first == OP_PUBKEYHASH) |
|
|
|
return true; |
|
|
|
addressRet.SetHash160((uint160)item.second); |
|
|
|
|
|
|
|
//if (keystore == NULL || keystore->HaveKey(addressRet))
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* keystore, CBitcoinAddress& addressRet) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (keystore) |
|
|
|
|
|
|
|
CRITICAL_BLOCK(keystore->cs_KeyStore) |
|
|
|
|
|
|
|
return ExtractAddressInner(scriptPubKey, keystore, addressRet); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return ExtractAddressInner(scriptPubKey, NULL, addressRet); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, int nHashType) |
|
|
|
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, int nHashType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
vector<vector<unsigned char> > stack; |
|
|
|
vector<vector<unsigned char> > stack; |
|
|
|