Skip to content

Commit 864cd27

Browse files
committed
Move CBitcoinAddress to base58.cpp
1 parent 5c8ff0d commit 864cd27

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/base58.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,30 @@ int CBase58Data::CompareTo(const CBase58Data& b58) const
212212

213213
namespace
214214
{
215+
/** base58-encoded Bitcoin addresses.
216+
* Public-key-hash-addresses have version 0 (or 111 testnet).
217+
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
218+
* Script-hash-addresses have version 5 (or 196 testnet).
219+
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
220+
*/
221+
class CBitcoinAddress : public CBase58Data {
222+
public:
223+
bool Set(const CKeyID &id);
224+
bool Set(const CScriptID &id);
225+
bool Set(const CTxDestination &dest);
226+
bool IsValid() const;
227+
bool IsValid(const CChainParams &params) const;
228+
229+
CBitcoinAddress() {}
230+
CBitcoinAddress(const CTxDestination &dest) { Set(dest); }
231+
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
232+
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
233+
234+
CTxDestination Get() const;
235+
bool GetKeyID(CKeyID &keyID) const;
236+
bool IsScript() const;
237+
};
238+
215239
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
216240
{
217241
private:

src/base58.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,6 @@ class CBase58Data
9595
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
9696
};
9797

98-
/** base58-encoded Bitcoin addresses.
99-
* Public-key-hash-addresses have version 0 (or 111 testnet).
100-
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
101-
* Script-hash-addresses have version 5 (or 196 testnet).
102-
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
103-
*/
104-
class CBitcoinAddress : public CBase58Data {
105-
public:
106-
bool Set(const CKeyID &id);
107-
bool Set(const CScriptID &id);
108-
bool Set(const CTxDestination &dest);
109-
bool IsValid() const;
110-
bool IsValid(const CChainParams &params) const;
111-
112-
CBitcoinAddress() {}
113-
CBitcoinAddress(const CTxDestination &dest) { Set(dest); }
114-
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
115-
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
116-
117-
CTxDestination Get() const;
118-
bool GetKeyID(CKeyID &keyID) const;
119-
bool IsScript() const;
120-
};
121-
12298
/**
12399
* A base58-encoded secret key
124100
*/

0 commit comments

Comments
 (0)