Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
This commit is contained in:
committed by
Jack Grigg
parent
90304c4214
commit
07444da1db
@@ -323,6 +323,28 @@ bool CBitcoinSecret::SetString(const std::string& strSecret)
|
||||
return SetString(strSecret.c_str());
|
||||
}
|
||||
|
||||
std::string EncodeDestination(const CTxDestination& dest)
|
||||
{
|
||||
CBitcoinAddress addr(dest);
|
||||
if (!addr.IsValid()) return "";
|
||||
return addr.ToString();
|
||||
}
|
||||
|
||||
CTxDestination DecodeDestination(const std::string& str)
|
||||
{
|
||||
return CBitcoinAddress(str).Get();
|
||||
}
|
||||
|
||||
bool IsValidDestinationString(const std::string& str, const CChainParams& params)
|
||||
{
|
||||
return CBitcoinAddress(str).IsValid(params);
|
||||
}
|
||||
|
||||
bool IsValidDestinationString(const std::string& str)
|
||||
{
|
||||
return CBitcoinAddress(str).IsValid();
|
||||
}
|
||||
|
||||
template<class DATA_TYPE, CChainParams::Base58Type PREFIX, size_t SER_SIZE>
|
||||
bool CZCEncoding<DATA_TYPE, PREFIX, SER_SIZE>::Set(const DATA_TYPE& addr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user