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/processor.h> | #include <avalanche/processor.h> | ||||
#include <avalanche/proof.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> | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | if ((keyHex.length() != 2 * CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && | ||||
keyHex.length() != 2 * CPubKey::PUBLIC_KEY_SIZE) || | keyHex.length() != 2 * CPubKey::PUBLIC_KEY_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)); | ||||
} | } | ||||
CPubKey pubkey{HexToPubKey(keyHex)}; | CPubKey pubkey{HexToPubKey(keyHex)}; | ||||
g_avalanche->addPeer(nodeid, 100, pubkey); | g_avalanche->addPeer(nodeid, avalanche::Proof(100), pubkey); | ||||
return {}; | return {}; | ||||
} | } | ||||
// clang-format off | // clang-format off | ||||
static const CRPCCommand commands[] = { | static const CRPCCommand commands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
{ "avalanche", "getavalanchekey", getavalanchekey, {}}, | { "avalanche", "getavalanchekey", getavalanchekey, {}}, | ||||
Show All 9 Lines |