diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-08-22 23:46:51 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-09-06 13:07:45 -0700 |
commit | 864cd278741ab0e17e7d93eedee39417d4797b37 (patch) | |
tree | 83c407bda9f0cf0437a4c46a7d35c37f732f9a05 /src/base58.cpp | |
parent | 5c8ff0d448ffdc6340b195ddfa2128d5f21a839b (diff) |
Move CBitcoinAddress to base58.cpp
Diffstat (limited to 'src/base58.cpp')
-rw-r--r-- | src/base58.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/base58.cpp b/src/base58.cpp index 69692c95eb..e093608aa3 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -212,6 +212,30 @@ int CBase58Data::CompareTo(const CBase58Data& b58) const namespace { +/** base58-encoded Bitcoin addresses. + * Public-key-hash-addresses have version 0 (or 111 testnet). + * The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key. + * Script-hash-addresses have version 5 (or 196 testnet). + * The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script. + */ +class CBitcoinAddress : public CBase58Data { +public: + bool Set(const CKeyID &id); + bool Set(const CScriptID &id); + bool Set(const CTxDestination &dest); + bool IsValid() const; + bool IsValid(const CChainParams ¶ms) const; + + CBitcoinAddress() {} + CBitcoinAddress(const CTxDestination &dest) { Set(dest); } + CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); } + CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); } + + CTxDestination Get() const; + bool GetKeyID(CKeyID &keyID) const; + bool IsScript() const; +}; + class CBitcoinAddressVisitor : public boost::static_visitor<bool> { private: |