Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show All 18 Lines | |||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <txdb.h> | #include <txdb.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <utilstrencodings.h> | #include <utilstrencodings.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <validationinterface.h> | |||||
#include <warnings.h> | #include <warnings.h> | ||||
#include <boost/thread/thread.hpp> // boost::thread::interrupt | #include <boost/thread/thread.hpp> // boost::thread::interrupt | ||||
#include <condition_variable> | #include <condition_variable> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <mutex> | #include <mutex> | ||||
▲ Show 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | CUpdatedBlock block; | ||||
block = latestblock; | block = latestblock; | ||||
} | } | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
ret.pushKV("hash", block.hash.GetHex()); | ret.pushKV("hash", block.hash.GetHex()); | ||||
ret.pushKV("height", block.height); | ret.pushKV("height", block.height); | ||||
return ret; | return ret; | ||||
} | } | ||||
UniValue syncwithvalidationinterfacequeue(const Config &config, | |||||
const JSONRPCRequest &request) { | |||||
if (request.fHelp || request.params.size() > 0) { | |||||
throw std::runtime_error( | |||||
"syncwithvalidationinterfacequeue\n" | |||||
"\nWaits for the validation interface queue to catch up on " | |||||
"everything that was there when we entered this function.\n" | |||||
"\nExamples:\n" + | |||||
HelpExampleCli("syncwithvalidationinterfacequeue", "") + | |||||
HelpExampleRpc("syncwithvalidationinterfacequeue", "")); | |||||
} | |||||
SyncWithValidationInterfaceQueue(); | |||||
return NullUniValue; | |||||
} | |||||
UniValue getdifficulty(const Config &config, const JSONRPCRequest &request) { | UniValue getdifficulty(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error("getdifficulty\n" | throw std::runtime_error("getdifficulty\n" | ||||
"\nReturns the proof-of-work difficulty as a " | "\nReturns the proof-of-work difficulty as a " | ||||
"multiple of the minimum difficulty.\n" | "multiple of the minimum difficulty.\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"n.nnn (numeric) the proof-of-work " | "n.nnn (numeric) the proof-of-work " | ||||
"difficulty as a multiple of the minimum " | "difficulty as a multiple of the minimum " | ||||
▲ Show 20 Lines • Show All 1,473 Lines • ▼ Show 20 Lines | static const ContextFreeRPCCommand commands[] = { | ||||
{ "blockchain", "getrawmempool", getrawmempool, {"verbose"} }, | { "blockchain", "getrawmempool", getrawmempool, {"verbose"} }, | ||||
{ "blockchain", "gettxout", gettxout, {"txid","n","include_mempool"} }, | { "blockchain", "gettxout", gettxout, {"txid","n","include_mempool"} }, | ||||
{ "blockchain", "gettxoutsetinfo", gettxoutsetinfo, {} }, | { "blockchain", "gettxoutsetinfo", gettxoutsetinfo, {} }, | ||||
{ "blockchain", "pruneblockchain", pruneblockchain, {"height"} }, | { "blockchain", "pruneblockchain", pruneblockchain, {"height"} }, | ||||
{ "blockchain", "verifychain", verifychain, {"checklevel","nblocks"} }, | { "blockchain", "verifychain", verifychain, {"checklevel","nblocks"} }, | ||||
{ "blockchain", "preciousblock", preciousblock, {"blockhash"} }, | { "blockchain", "preciousblock", preciousblock, {"blockhash"} }, | ||||
/* Not shown in help */ | /* Not shown in help */ | ||||
{ "hidden", "getfinalizedblockhash", getfinalizedblockhash, {} }, | { "hidden", "getfinalizedblockhash", getfinalizedblockhash, {} }, | ||||
{ "hidden", "finalizeblock", finalizeblock, {"blockhash"} }, | { "hidden", "finalizeblock", finalizeblock, {"blockhash"} }, | ||||
{ "hidden", "invalidateblock", invalidateblock, {"blockhash"} }, | { "hidden", "invalidateblock", invalidateblock, {"blockhash"} }, | ||||
{ "hidden", "parkblock", parkblock, {"blockhash"} }, | { "hidden", "parkblock", parkblock, {"blockhash"} }, | ||||
{ "hidden", "reconsiderblock", reconsiderblock, {"blockhash"} }, | { "hidden", "reconsiderblock", reconsiderblock, {"blockhash"} }, | ||||
{ "hidden", "syncwithvalidationinterfacequeue", syncwithvalidationinterfacequeue, {} }, | |||||
{ "hidden", "unparkblock", unparkblock, {"blockhash"} }, | { "hidden", "unparkblock", unparkblock, {"blockhash"} }, | ||||
{ "hidden", "waitfornewblock", waitfornewblock, {"timeout"} }, | { "hidden", "waitfornewblock", waitfornewblock, {"timeout"} }, | ||||
{ "hidden", "waitforblock", waitforblock, {"blockhash","timeout"} }, | { "hidden", "waitforblock", waitforblock, {"blockhash","timeout"} }, | ||||
{ "hidden", "waitforblockheight", waitforblockheight, {"height","timeout"} }, | { "hidden", "waitforblockheight", waitforblockheight, {"height","timeout"} }, | ||||
}; | }; | ||||
// clang-format on | // clang-format on | ||||
void RegisterBlockchainRPCCommands(CRPCTable &t) { | void RegisterBlockchainRPCCommands(CRPCTable &t) { | ||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) { | for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) { | ||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]); | t.appendCommand(commands[vcidx].name, &commands[vcidx]); | ||||
} | } | ||||
} | } |