Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
// Copyright (c) 2020 The Bitcoin developers | // Copyright (c) 2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <avalanche.h> | #include <avalanche.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <key_io.h> | #include <key_io.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#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) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error(RPCHelpMan{ | ||||
RPCHelpMan{"getavalanchekey", | "getavalanchekey", | ||||
"\nReturns the key used to sign avalanche messages.\n", | "\nReturns the key used to sign avalanche messages.\n", | ||||
{}} | {}, | ||||
.ToString() + | RPCResults{}, | ||||
"\nExamples:\n" + HelpExampleRpc("getavalanchekey", "")); | RPCExamples{HelpExampleRpc("getavalanchekey", "")}, | ||||
} | |||||
.ToString()); | |||||
} | } | ||||
if (!g_avalanche) { | if (!g_avalanche) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Avalanche is not initialized"); | "Avalanche is not initialized"); | ||||
} | } | ||||
return HexStr(g_avalanche->getSessionPubKey()); | return HexStr(g_avalanche->getSessionPubKey()); | ||||
Show All 15 Lines |