aboutsummaryrefslogtreecommitdiff
path: root/src/script.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/script.h')
-rw-r--r--src/script.h31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/script.h b/src/script.h
index 2a36db2faf..9d94e3f5c8 100644
--- a/src/script.h
+++ b/src/script.h
@@ -622,7 +622,7 @@ public:
}
- uint160 GetBitcoinAddressHash160() const
+ CBitcoinAddress GetBitcoinAddress() const
{
opcodetype opcode;
std::vector<unsigned char> vch;
@@ -634,36 +634,18 @@ public:
if (!GetOp(pc, opcode, vch) || opcode != OP_EQUALVERIFY) return 0;
if (!GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG) return 0;
if (pc != end()) return 0;
- return hash160;
+ return CBitcoinAddress(hash160);
}
- std::string GetBitcoinAddress() const
- {
- uint160 hash160 = GetBitcoinAddressHash160();
- if (hash160 == 0)
- return "";
- return Hash160ToAddress(hash160);
- }
-
- void SetBitcoinAddress(const uint160& hash160)
+ void SetBitcoinAddress(const CBitcoinAddress& address)
{
this->clear();
- *this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
+ *this << OP_DUP << OP_HASH160 << address.GetHash160() << OP_EQUALVERIFY << OP_CHECKSIG;
}
void SetBitcoinAddress(const std::vector<unsigned char>& vchPubKey)
{
- SetBitcoinAddress(Hash160(vchPubKey));
- }
-
- bool SetBitcoinAddress(const std::string& strAddress)
- {
- this->clear();
- uint160 hash160;
- if (!AddressToHash160(strAddress, hash160))
- return false;
- SetBitcoinAddress(hash160);
- return true;
+ SetBitcoinAddress(CBitcoinAddress(vchPubKey));
}
@@ -710,8 +692,7 @@ public:
bool IsStandard(const CScript& scriptPubKey);
bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
-bool ExtractPubKey(const CScript& scriptPubKey, const CKeyStore* pkeystore, std::vector<unsigned char>& vchPubKeyRet);
-bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);
+bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* pkeystore, CBitcoinAddress& addressRet);
bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL, CScript scriptPrereq=CScript());
bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType=0);