MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getdifficulty

Function getdifficulty

src/rpc/blockchain.cpp:503–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501}
502
503static RPCMethod getdifficulty()
504{
505 return RPCMethod{
506 "getdifficulty",
507 "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.\n",
508 {},
509 RPCResult{
510 RPCResult::Type::NUM, "", "the proof-of-work difficulty as a multiple of the minimum difficulty."},
511 RPCExamples{
512 HelpExampleCli("getdifficulty", "")
513 + HelpExampleRpc("getdifficulty", "")
514 },
515 [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
516{
517 ChainstateManager& chainman = EnsureAnyChainman(request.context);
518 LOCK(cs_main);
519 return GetDifficulty(*CHECK_NONFATAL(chainman.ActiveChain().Tip()));
520},
521 };
522}
523
524static RPCMethod getblockfrompeer()
525{

Callers

nothing calls this directly

Calls 4

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetDifficultyFunction · 0.85
TipMethod · 0.45

Tested by

no test coverage detected