Changeset View
Changeset View
Standalone View
Standalone View
src/base58.cpp
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | std::string operator()(const CScriptID &id) const { | ||||
m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS); | m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS); | ||||
data.insert(data.end(), id.begin(), id.end()); | data.insert(data.end(), id.begin(), id.end()); | ||||
return EncodeBase58Check(data); | return EncodeBase58Check(data); | ||||
} | } | ||||
std::string operator()(const CNoDestination &no) const { return ""; } | std::string operator()(const CNoDestination &no) const { return ""; } | ||||
}; | }; | ||||
CTxDestination DecodeDestination(const std::string &str, | CTxDestination DecodeLegacyDestination(const std::string &str, | ||||
const CChainParams ¶ms) { | const CChainParams ¶ms) { | ||||
std::vector<uint8_t> data; | std::vector<uint8_t> data; | ||||
uint160 hash; | uint160 hash; | ||||
if (!DecodeBase58Check(str, data)) { | if (!DecodeBase58Check(str, data)) { | ||||
return CNoDestination(); | return CNoDestination(); | ||||
} | } | ||||
// Base58Check decoding | // Base58Check decoding | ||||
const std::vector<uint8_t> &pubkey_prefix = | const std::vector<uint8_t> &pubkey_prefix = | ||||
params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); | params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
std::string EncodeLegacyAddr(const CTxDestination &dest, | std::string EncodeLegacyAddr(const CTxDestination &dest, | ||||
const CChainParams ¶ms) { | const CChainParams ¶ms) { | ||||
return boost::apply_visitor(DestinationEncoder(params), dest); | return boost::apply_visitor(DestinationEncoder(params), dest); | ||||
} | } | ||||
CTxDestination DecodeLegacyAddr(const std::string &str, | CTxDestination DecodeLegacyAddr(const std::string &str, | ||||
const CChainParams ¶ms) { | const CChainParams ¶ms) { | ||||
return DecodeDestination(str, params); | return DecodeLegacyDestination(str, params); | ||||
} | } |