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/avalanche.h> | #include <avalanche/avalanche.h> | ||||
#include <avalanche/delegation.h> | #include <avalanche/delegation.h> | ||||
#include <avalanche/delegationbuilder.h> | #include <avalanche/delegationbuilder.h> | ||||
#include <avalanche/peermanager.h> | #include <avalanche/peermanager.h> | ||||
#include <avalanche/processor.h> | #include <avalanche/processor.h> | ||||
#include <avalanche/proof.h> | #include <avalanche/proof.h> | ||||
#include <avalanche/proofbuilder.h> | #include <avalanche/proofbuilder.h> | ||||
#include <avalanche/validation.h> | #include <avalanche/validation.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <core_io.h> | #include <core_io.h> | ||||
#include <key_io.h> | #include <key_io.h> | ||||
#include <net_processing.h> | |||||
#include <node/context.h> | #include <node/context.h> | ||||
#include <rpc/blockchain.h> | #include <rpc/blockchain.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 469 Lines • ▼ Show 20 Lines | static UniValue sendavalancheproof(const Config &config, | ||||
// already is a proof with conflicting utxos. | // already is a proof with conflicting utxos. | ||||
const avalanche::ProofId &proofid = proof->getId(); | const avalanche::ProofId &proofid = proof->getId(); | ||||
if (!g_avalanche->getProof(proofid) && !g_avalanche->addProof(proof)) { | if (!g_avalanche->getProof(proofid) && !g_avalanche->addProof(proof)) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
"The proof has conflicting utxo with an existing proof"); | "The proof has conflicting utxo with an existing proof"); | ||||
} | } | ||||
// TODO actually announce the proof via an inv message | RelayProof(proofid, *node.connman); | ||||
// RelayProof(proofid, *node.connman); | |||||
return true; | return true; | ||||
} | } | ||||
static UniValue verifyavalancheproof(const Config &config, | static UniValue verifyavalancheproof(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"verifyavalancheproof", | "verifyavalancheproof", | ||||
Show All 40 Lines |