Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show All 12 Lines | |||||
static UniValue getavalanchekey(const Config &config, | static UniValue getavalanchekey(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"getavalanchekey", | RPCHelpMan{"getavalanchekey", | ||||
"\nReturns the key used to sign avalanche messages.\n", | "\nReturns the key used to sign avalanche messages.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nExamples:\n" + HelpExampleRpc("getavalanchekey", "")); | "\nExamples:\n" + HelpExampleRpc("getavalanchekey", "")); | ||||
} | } | ||||
if (!g_avalanche) { | 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 UniValue addavalanchepeer(const Config &config, | static UniValue addavalanchepeer(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"addavalanchepeer", | "addavalanchepeer", | ||||
"\nAdd a peer to the set of peer to poll for avalanche.\n", | "\nAdd a peer to the set of peer to poll for avalanche.\n", | ||||
{ | { | ||||
{"nodeid", RPCArg::Type::NUM, /* opt */ false, | {"nodeid", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_value */ "", "Node to be added to avalanche."}, | /* default_value */ "", "Node to be added to avalanche."}, | ||||
{"publickey", RPCArg::Type::STR_HEX, /* opt */ false, | {"publickey", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_value */ "", "The public key of the node."}, | /* default_value */ "", "The public key of the node."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nExamples:\n" + HelpExampleRpc("addavalanchepeer", "5")); | "\nExamples:\n" + HelpExampleRpc("addavalanchepeer", "5")); | ||||
} | } | ||||
if (!g_avalanche) { | if (!g_avalanche) { | ||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | ||||
} | } | ||||
// Parse nodeid | // Parse nodeid | ||||
Show All 37 Lines |