| 842 | } |
| 843 | |
| 844 | static 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 | |
| 877 | static UniValue estimatefee(const JSONRPCRequest& request) |
| 878 | { |
nothing calls this directly
no test coverage detected