MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / getblocksubsidy

Function getblocksubsidy

src/rpc/mining.cpp:844–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

842}
843
844static UniValue getblocksubsidy(const JSONRPCRequest& request)
845{
846 if (request.fHelp || request.params.size() > 1)
847 throw std::runtime_error(
848 "getblocksubsidy height\n"
849 "\nReturns block subsidy reward of block at index provided.\n"
850 "\nArguments:\n"
851 "1. height (numeric, optional) The block height. If not provided, defaults to the current height of the chain.\n"
852 "\nResult:\n"
853 "{\n"
854 "\"miner\": n, (numeric) The mining reward amount in satoshis.\n"
855 "\"founders\": f, (numeric) Always 0, for Zcash mining compatibility.\n"
856 "}\n"
857 "\nExamples:\n" +
858 HelpExampleCli("getblocksubsidy", "1000") + HelpExampleRpc("getblocksubsidy", "1000"));
859
860 RPCTypeCheck(request.params, {UniValue::VNUM});
861
862 LOCK(cs_main);
863 int nHeight = (request.params.size() == 1) ? request.params[0].get_int() : chainActive.Height();
864 if (nHeight < 0) {
865 throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range.");
866 }
867
868 UniValue result(UniValue::VOBJ);
869
870 CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus());
871 result.pushKV("miner", nReward);
872 result.pushKV("founders", 0);
873
874 return result;
875}
876
877static UniValue estimatefee(const JSONRPCRequest& request)
878{

Callers

nothing calls this directly

Calls 10

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
JSONRPCErrorFunction · 0.85
GetBlockSubsidyFunction · 0.85
get_intMethod · 0.80
HeightMethod · 0.80
ParamsClass · 0.50
sizeMethod · 0.45
pushKVMethod · 0.45

Tested by

no test coverage detected