Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show All 11 Lines | |||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
static UniValue getavalanchekey(const Config &config, | static UniValue getavalanchekey(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"getavalanchekey", | "getavalanchekey", | ||||
"\nReturns the key used to sign avalanche messages.\n", | "Returns the key used to sign avalanche messages.\n", | ||||
{}, | {}, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleRpc("getavalanchekey", "")}, | RPCExamples{HelpExampleRpc("getavalanchekey", "")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
if (!g_avalanche) { | if (!g_avalanche) { | ||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | ||||
Show All 13 Lines | static CPubKey ParsePubKey(const UniValue ¶m) { | ||||
return HexToPubKey(keyHex); | return HexToPubKey(keyHex); | ||||
} | } | ||||
static UniValue addavalanchenode(const Config &config, | static UniValue addavalanchenode(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"addavalanchenode", | "addavalanchenode", | ||||
"\nAdd a node in the set of peers to poll for avalanche.\n", | "Add a node in the set of peers to poll for avalanche.\n", | ||||
{ | { | ||||
{"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, | {"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
"Node to be added to avalanche."}, | "Node to be added to avalanche."}, | ||||
{"publickey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"publickey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The public key of the node."}, | "The public key of the node."}, | ||||
{"proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"Proof that the node is not a sybil."}, | "Proof that the node is not a sybil."}, | ||||
}, | }, | ||||
Show All 21 Lines | static UniValue addavalanchenode(const Config &config, | ||||
return g_avalanche->addNode(nodeid, proof, key); | return g_avalanche->addNode(nodeid, proof, key); | ||||
} | } | ||||
static UniValue buildavalancheproof(const Config &config, | static UniValue buildavalancheproof(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"buildavalancheproof", | "buildavalancheproof", | ||||
"\nBuild a proof for avalanche's sybil resistance.\n", | "Build a proof for avalanche's sybil resistance.\n", | ||||
{ | { | ||||
{"sequence", RPCArg::Type::NUM, RPCArg::Optional::NO, | {"sequence", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
"The proof's sequence"}, | "The proof's sequence"}, | ||||
{"expiration", RPCArg::Type::NUM, RPCArg::Optional::NO, | {"expiration", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
"A timestamp indicating when the proof expire"}, | "A timestamp indicating when the proof expire"}, | ||||
{"master", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"master", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The master public key"}, | "The master public key"}, | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |