Closed brunoerg closed 3 years ago
RPC code:
static RPCHelpMan getbestblockhash() { return RPCHelpMan{"getbestblockhash", "\nReturns the hash of the best (tip) block in the most-work fully-validated chain.\n", {}, RPCResult{ RPCResult::Type::STR_HEX, "", "the block hash, hex-encoded"}, RPCExamples{ HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "") }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); return ::ChainActive().Tip()->GetBlockHash().GetHex(); }, }; }
RPC code: