Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show All 27 Lines | if (!g_avalanche) { | ||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | ||||
} | } | ||||
return HexStr(g_avalanche->getSessionPubKey()); | return HexStr(g_avalanche->getSessionPubKey()); | ||||
} | } | ||||
static CPubKey ParsePubKey(const UniValue ¶m) { | static CPubKey ParsePubKey(const UniValue ¶m) { | ||||
const std::string keyHex = param.get_str(); | const std::string keyHex = param.get_str(); | ||||
if ((keyHex.length() != 2 * CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && | if ((keyHex.length() != 2 * CPubKey::COMPRESSED_SIZE && | ||||
keyHex.length() != 2 * CPubKey::PUBLIC_KEY_SIZE) || | keyHex.length() != 2 * CPubKey::SIZE) || | ||||
!IsHex(keyHex)) { | !IsHex(keyHex)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
strprintf("Invalid public key: %s\n", keyHex)); | strprintf("Invalid public key: %s\n", keyHex)); | ||||
} | } | ||||
return HexToPubKey(keyHex); | return HexToPubKey(keyHex); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |