Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
Show First 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | |||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | ||||
LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : nullptr); | LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : nullptr); | ||||
#else | #else | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
#endif | #endif | ||||
CTxDestination dest = DecodeDestination(request.params[0].get_str()); | CTxDestination dest = | ||||
DecodeDestination(request.params[0].get_str(), config.GetChainParams()); | |||||
bool isValid = IsValidDestination(dest); | bool isValid = IsValidDestination(dest); | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
ret.push_back(Pair("isvalid", isValid)); | ret.push_back(Pair("isvalid", isValid)); | ||||
if (isValid) { | if (isValid) { | ||||
std::string currentAddress = EncodeDestination(dest); | std::string currentAddress = EncodeDestination(dest); | ||||
ret.push_back(Pair("address", currentAddress)); | ret.push_back(Pair("address", currentAddress)); | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | static UniValue verifymessage(const Config &config, | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
std::string strAddress = request.params[0].get_str(); | std::string strAddress = request.params[0].get_str(); | ||||
std::string strSign = request.params[1].get_str(); | std::string strSign = request.params[1].get_str(); | ||||
std::string strMessage = request.params[2].get_str(); | std::string strMessage = request.params[2].get_str(); | ||||
CTxDestination destination = DecodeDestination(strAddress); | CTxDestination destination = | ||||
DecodeDestination(strAddress, config.GetChainParams()); | |||||
if (!IsValidDestination(destination)) { | if (!IsValidDestination(destination)) { | ||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); | throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); | ||||
} | } | ||||
const CKeyID *keyID = boost::get<CKeyID>(&destination); | const CKeyID *keyID = boost::get<CKeyID>(&destination); | ||||
if (!keyID) { | if (!keyID) { | ||||
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key"); | throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |