Skip to content

Commit e7c5d9a

Browse files
committed
Move CBitcoinAddress to base58.cpp
1 parent 548f828 commit e7c5d9a

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

src/base58.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,42 @@ int CBase58Data::CompareTo(const CBase58Data& b58) const
231231

232232
namespace
233233
{
234+
/** base58-encoded PIVX addresses.
235+
* Public-key-hash-addresses have version 0 (or 111 testnet).
236+
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
237+
* Script-hash-addresses have version 5 (or 196 testnet).
238+
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
239+
*/
240+
class CBitcoinAddress : public CBase58Data
241+
{
242+
public:
243+
bool Set(const CKeyID& id, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
244+
bool Set(const CScriptID& id);
245+
bool Set(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
246+
bool IsValid() const;
247+
bool IsValid(const CChainParams& params) const;
248+
249+
CBitcoinAddress() {}
250+
CBitcoinAddress(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS) { Set(dest, addrType); }
251+
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
252+
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
253+
254+
CTxDestination Get() const;
255+
bool GetKeyID(CKeyID& keyID) const;
256+
bool IsScript() const;
257+
bool IsStakingAddress() const;
258+
259+
260+
// Helpers
261+
static const CBitcoinAddress newCSInstance(const CTxDestination& dest) {
262+
return CBitcoinAddress(dest, CChainParams::STAKING_ADDRESS);
263+
}
264+
265+
static const CBitcoinAddress newInstance(const CTxDestination& dest) {
266+
return CBitcoinAddress(dest, CChainParams::PUBKEY_ADDRESS);
267+
}
268+
};
269+
234270
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
235271
{
236272
private:

src/base58.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -101,42 +101,6 @@ class CBase58Data
101101
bool operator>(const CBase58Data& b58) const { return CompareTo(b58) > 0; }
102102
};
103103

104-
/** base58-encoded PIVX addresses.
105-
* Public-key-hash-addresses have version 0 (or 111 testnet).
106-
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
107-
* Script-hash-addresses have version 5 (or 196 testnet).
108-
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
109-
*/
110-
class CBitcoinAddress : public CBase58Data
111-
{
112-
public:
113-
bool Set(const CKeyID& id, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
114-
bool Set(const CScriptID& id);
115-
bool Set(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
116-
bool IsValid() const;
117-
bool IsValid(const CChainParams& params) const;
118-
119-
CBitcoinAddress() {}
120-
CBitcoinAddress(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS) { Set(dest, addrType); }
121-
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
122-
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
123-
124-
CTxDestination Get() const;
125-
bool GetKeyID(CKeyID& keyID) const;
126-
bool IsScript() const;
127-
bool IsStakingAddress() const;
128-
129-
130-
// Helpers
131-
static const CBitcoinAddress newCSInstance(const CTxDestination& dest) {
132-
return CBitcoinAddress(dest, CChainParams::STAKING_ADDRESS);
133-
}
134-
135-
static const CBitcoinAddress newInstance(const CTxDestination& dest) {
136-
return CBitcoinAddress(dest, CChainParams::PUBKEY_ADDRESS);
137-
}
138-
};
139-
140104
CKey DecodeSecret(const std::string& str);
141105
std::string EncodeSecret(const CKey& key);
142106

0 commit comments

Comments
 (0)