MCPcopy Create free account
hub / github.com/ElementsProject/elements / getnetworkhashps

Function getnetworkhashps

src/rpc/mining.cpp:101–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101static RPCHelpMan getnetworkhashps()
102{
103 return RPCHelpMan{"getnetworkhashps",
104 "\nReturns the estimated network hashes per second based on the last n blocks.\n"
105 "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
106 "Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
107 {
108 {"nblocks", RPCArg::Type::NUM, RPCArg::Default{120}, "The number of blocks, or -1 for blocks since last difficulty change."},
109 {"height", RPCArg::Type::NUM, RPCArg::Default{-1}, "To estimate at the time of the given height."},
110 },
111 RPCResult{
112 RPCResult::Type::NUM, "", "Hashes per second estimated"},
113 RPCExamples{
114 HelpExampleCli("getnetworkhashps", "")
115 + HelpExampleRpc("getnetworkhashps", "")
116 },
117 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
118{
119 ChainstateManager& chainman = EnsureAnyChainman(request.context);
120 LOCK(cs_main);
121 return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1, chainman.ActiveChain());
122},
123 };
124}
125
126static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t& max_tries, unsigned int& extra_nonce, uint256& block_hash)
127{

Callers 1

getmininginfoFunction · 0.85

Calls 5

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetNetworkHashPSFunction · 0.85
get_intMethod · 0.80
isNullMethod · 0.45

Tested by

no test coverage detected