Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show All 11 Lines | |||||
#include "consensus/params.h" | #include "consensus/params.h" | ||||
#include "consensus/validation.h" | #include "consensus/validation.h" | ||||
#include "core_io.h" | #include "core_io.h" | ||||
#include "init.h" | #include "init.h" | ||||
#include "miner.h" | #include "miner.h" | ||||
#include "net.h" | #include "net.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "pow.h" | #include "pow.h" | ||||
#include "rpc/blockchain.h" | |||||
#include "rpc/server.h" | #include "rpc/server.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 "validationinterface.h" | ||||
#include <univalue.h> | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
#include <univalue.h> | |||||
/** | /** | ||||
* Return average network hashes per second based on the last 'lookup' blocks, | * Return average network hashes per second based on the last 'lookup' blocks, | ||||
* or from the last difficulty change if 'lookup' is nonpositive. If 'height' is | * or from the last difficulty change if 'lookup' is nonpositive. If 'height' is | ||||
* nonnegative, compute the estimate at the time when a given block was found. | * nonnegative, compute the estimate at the time when a given block was found. | ||||
*/ | */ | ||||
static UniValue GetNetworkHashPS(int lookup, int height) { | static UniValue GetNetworkHashPS(int lookup, int height) { | ||||
CBlockIndex *pb = chainActive.Tip(); | CBlockIndex *pb = chainActive.Tip(); | ||||
▲ Show 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | static UniValue getmininginfo(const Config &config, | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.push_back(Pair("blocks", int(chainActive.Height()))); | obj.push_back(Pair("blocks", int(chainActive.Height()))); | ||||
obj.push_back(Pair("currentblocksize", uint64_t(nLastBlockSize))); | obj.push_back(Pair("currentblocksize", uint64_t(nLastBlockSize))); | ||||
obj.push_back(Pair("currentblocktx", uint64_t(nLastBlockTx))); | obj.push_back(Pair("currentblocktx", uint64_t(nLastBlockTx))); | ||||
obj.push_back(Pair("difficulty", double(GetDifficulty()))); | obj.push_back(Pair("difficulty", double(GetDifficulty(chainActive.Tip())))); | ||||
obj.push_back(Pair("blockprioritypercentage", | obj.push_back(Pair("blockprioritypercentage", | ||||
uint8_t(GetArg("-blockprioritypercentage", | uint8_t(GetArg("-blockprioritypercentage", | ||||
DEFAULT_BLOCK_PRIORITY_PERCENTAGE)))); | DEFAULT_BLOCK_PRIORITY_PERCENTAGE)))); | ||||
obj.push_back(Pair("errors", GetWarnings("statusbar"))); | obj.push_back(Pair("errors", GetWarnings("statusbar"))); | ||||
obj.push_back(Pair("networkhashps", getnetworkhashps(config, request))); | obj.push_back(Pair("networkhashps", getnetworkhashps(config, request))); | ||||
obj.push_back(Pair("pooledtx", uint64_t(mempool.size()))); | obj.push_back(Pair("pooledtx", uint64_t(mempool.size()))); | ||||
obj.push_back(Pair("chain", Params().NetworkIDString())); | obj.push_back(Pair("chain", Params().NetworkIDString())); | ||||
return obj; | return obj; | ||||
▲ Show 20 Lines • Show All 799 Lines • Show Last 20 Lines |