message: Add get subsidy RPC call
diff: @@ -220,6 +220,17 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
  return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);
  }
  +UniValue getsubsidy(const JSONRPCRequest& request)
  +{
  + if (request.fHelp || request.params.size() > 1)
  + throw runtime_error(
  + "getsubsidy [nTarget]\n"
  + "Returns subsidy value for the specified value of target.");
  + int nTarget = request.params.size() == 1 ? request.params[0].get_int() : chainActive.Height();
  + const Consensus::Params& consensusParams = Params().GetConsensus();
  + return (uint64_t)GetBlockSubsidy(nTarget, consensusParams);
  +}
  +
  UniValue getmininginfo(const JSONRPCRequest& request)
  {
  if (request.fHelp || request.params.size() != 0)
  @@ -988,6 +999,7 @@ static const CRPCCommand commands[] =
  { "mining", "prioritisetransaction", &prioritisetransaction, true, {"txid","priority_delta","fee_delta"} },
  { "mining", "getblocktemplate", &getblocktemplate, true, {"template_request"} },
  { "mining", "submitblock", &submitblock, true, {"hexdata","parameters"} },
  + { "mining", "getsubsidy", &getsubsidy, true, {"nTarget"} },
  { "mining", "getstakinginfo", &getstakinginfo, true, {} },
  { "generating", "generate", &generate, true, {"nblocks","maxtries"} },
  