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:
1 parent
6866b4912b
commit
5c8ff0d448
26 files changed
+299
-277
No files matched your search
@@ -318,3 +318,25 @@ 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();
|
||||
}
|
||||
Reference in new issue
Block a user