}
-bool ExtractHash160(const CScript& scriptPubKey, const CKeyStore* keystore, uint160& hash160Ret)
+bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* keystore, CBitcoinAddress& addressRet)
{
vector<pair<opcodetype, valtype> > vSolution;
if (!Solver(scriptPubKey, vSolution))
{
uint160 hash160;
if (item.first == OP_PUBKEY)
- {
- hash160 = Hash160(item.second);
- }
+ addressRet.SetAddress(item.second);
else if (item.first == OP_PUBKEYHASH)
- {
- hash160 = uint160(item.second);
- }
- if (keystore == NULL || keystore->HaveKey(hash160))
- {
- hash160Ret = hash160;
+ addressRet.SetAddress(uint160(item.second));
+ if (keystore == NULL || keystore->HaveKey(addressRet))
return true;
- }
}
}
return false;