Mercurial > hg > bitcoin
diff src/script.cpp @ 814:346b6b1b54f3 draft
Use CBitcoinAddress instead of string/uint160
Instead of conversion functions between pubkey/uint160/address in
base58.h, have a fully fledged class CBitcoinAddress (CAddress was
already taken) to represent addresses.
author | Pieter Wuille <pieter.wuille@gmail.com> |
---|---|
date | Tue, 05 Jul 2011 20:53:43 +0200 |
parents | 62b46930aaa4 |
children | 82d12cc83929 |
line wrap: on
line diff
--- a/src/script.cpp +++ b/src/script.cpp @@ -1123,7 +1123,7 @@ } -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)) @@ -1135,18 +1135,11 @@ { 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;