diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2011-07-05 20:53:43 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2011-07-17 12:09:14 +0200 |
commit | 2ffba736e9102d016b96c2e5de2ce7757e612667 (patch) | |
tree | fb96acfec05aa767cb3ba2df9b93569f2a6c04db /src/script.cpp | |
parent | 03fbd7904903928b0d1c8542a3d597aaf5bdd31b (diff) |
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.
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/script.cpp b/src/script.cpp index b92f7b08b6..f917600848 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1123,7 +1123,7 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) } -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 @@ bool ExtractHash160(const CScript& scriptPubKey, const CKeyStore* keystore, uint { 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; |