message: Added params to listminting (WIP)
diff: @@ -795,9 +795,17 @@ Value listminting(const Array& params, bool fHelp)
  {
  if(fHelp || params.size() > 2)
  throw runtime_error(
  - "listminting\n"
  + "listminting [count=-1] [from=0]\n"
  "Return all mintable outputs and provide details for each of them.");
  + int64 count = -1;
  + if(params.size() > 0)
  + count = params[0].get_int();
  +
  + int64 from = 0;
  + if(params.size() > 1)
  + from = params[1].get_int();
  +
  Array ret;
  const CBlockIndex *p = GetLastBlockIndex(pindexBest, true);
  @@ -805,10 +813,16 @@ Value listminting(const Array& params, bool fHelp)
  for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
  {
  +
  QList<KernelRecord> txList = KernelRecord::decomposeOutput(pwalletMain, it->second);
  int minAge = nStakeMinAge / 60 / 60 / 24;
  for(QList<KernelRecord>::iterator i = txList.begin(); i != txList.end(); ++i) {
  if(!(*i).spent) {
  +
  + if(count > 0 && ret.size() >= count) {
  + break;
  + }
  +
  KernelRecord kr = *i;
  string strTime = boost::lexical_cast<std::string>(kr.nTime);
  @@ -829,8 +843,6 @@ Value listminting(const Array& params, bool fHelp)
  searchInterval = (int)nLastCoinStakeSearchInterval;
  attemps = GetAdjustedTime() - kr.nTime - nStakeMinAge;
  }
  - double target = kr.getProbToMintStake(difficulty) * pow(2, 256);
  -
  Object obj;
  obj.push_back(Pair("account", account));
  @@ -846,7 +858,6 @@ Value listminting(const Array& params, bool fHelp)
  obj.push_back(Pair("minting-probability-24h", kr.getProbToMintWithinNMinutes(difficulty, 60*24)));
  obj.push_back(Pair("minting-probability-30d", kr.getProbToMintWithinNMinutes(difficulty, 60*24*30)));
  obj.push_back(Pair("minting-probability-90d", kr.getProbToMintWithinNMinutes(difficulty, 60*24*90)));
  - obj.push_back(Pair("target", target));
  obj.push_back(Pair("search-interval-in-sec", searchInterval));
  obj.push_back(Pair("attempts", attemps));
  ret.push_back(obj);
  @@ -3183,6 +3194,8 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
  throw runtime_error("type mismatch "+s);
  params[1] = v.get_array();
  }
  + if (strMethod == "listminting" && n > 0) ConvertTo<boost::int64_t>(params[0]);
  + if (strMethod == "listminting" && n > 1) ConvertTo<boost::int64_t>(params[1]);
  return params;
  }
  