// - Double-clicking selects the whole number as one word if it's all alphanumeric.
//
-#include <string>
-#include <vector>
-#include "key.h"
-#include "script.h"
#include "base58.h"
+#include "hash.h"
static const std::array<char, 58> digits = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
std::string CBase58Data::ToString() const
{
- std::vector<unsigned char> vch(1, nVersion);
+ std::vector<unsigned char> vch{nVersion};
vch.insert(vch.end(), vchData.begin(), vchData.end());
return EncodeBase58Check(vch);
}
return 0;
}
+ namespace {
+ class CBitcoinAddressVisitor {
+ private:
+ CBitcoinAddress *addr;
+ public:
+ explicit CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { }
+
+ bool operator()(const CKeyID &id) const { return addr->Set(id); }
+ bool operator()(const CScriptID &id) const { return addr->Set(id); }
+ bool operator()(const CMalleablePubKey &mpk) const { return addr->Set(mpk); }
+ bool operator()([[maybe_unused]] const CNoDestination &no) const { return false; }
+ };
+ } // namespace
+
bool CBitcoinAddress::Set(const CKeyID &id) {
SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &id, 20);
return true;
bool CBitcoinAddress::Set(const CTxDestination &dest)
{
- return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
+ return std::visit(CBitcoinAddressVisitor(this), dest);
}
bool CBitcoinAddress::Set(const CMalleablePubKey &mpk) {
if (fSeemsSane && !fSimple)
{
- // Perform dditional checking
+ // Perform additional checking
// for pubkey pair addresses
CMalleablePubKey mpk;
mpk.setvch(vchData);
{
SetSecret(vchSecret, fCompressed);
}
-
-