using namespace std;
extern uint256 nPoWBase;
+extern uint64_t nStakeInputsMapSize;
Value getsubsidy(const Array& params, bool fHelp)
{
"getmininginfo\n"
"Returns an object containing mining-related information.");
- float nKernelsRate = 0, nCoinDaysRate = 0;
- pwalletMain->GetStakeStats(nKernelsRate, nCoinDaysRate);
-
Object obj, diff, weight;
obj.push_back(Pair("blocks", (int)nBestHeight));
obj.push_back(Pair("currentblocksize",(uint64_t)nLastBlockSize));
obj.push_back(Pair("difficulty", diff));
obj.push_back(Pair("blockvalue", (uint64_t)GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nBits)));
- obj.push_back(Pair("netmhashps", GetPoWMHashPS()));
- obj.push_back(Pair("netstakeweight", GetPoSKernelPS()));
+ obj.push_back(Pair("netmhashps", GetPoWMHashPS()));
+ obj.push_back(Pair("netstakeweight",GetPoSKernelPS()));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
- weight.push_back(Pair("kernelsrate", nKernelsRate));
- weight.push_back(Pair("cdaysrate", nCoinDaysRate));
- obj.push_back(Pair("stakestats", weight));
+ obj.push_back(Pair("stakeinputs", (uint64_t)nStakeInputsMapSize));
+ obj.push_back(Pair("stakeinterest", GetProofOfStakeReward(0, GetLastBlockIndex(pindexBest, true)->nBits, GetLastBlockIndex(pindexBest, true)->nTime, true)));
- obj.push_back(Pair("stakeinterest", (uint64_t)GetProofOfStakeReward(0, GetLastBlockIndex(pindexBest, true)->nBits, GetLastBlockIndex(pindexBest, true)->nTime, true)));
obj.push_back(Pair("testnet", fTestNet));
return obj;
}
interval.first += (nStakeMinAge + block.nTime - interval.first);
interval.second = interval.first + nDays * 86400;
- SHA256_CTX ctx;
- GetKernelMidstate(nStakeModifier, block.nTime, txindex.pos.nTxPos - txindex.pos.nBlockPos, tx.nTime, nOut, ctx);
+ // Build static part of kernel
+ CDataStream ssKernel(SER_GETHASH, 0);
+ ssKernel << nStakeModifier;
+ ssKernel << block.nTime << (txindex.pos.nTxPos - txindex.pos.nBlockPos) << tx.nTime << nOut;
+ CDataStream::const_iterator itK = ssKernel.begin();
- std::pair<uint256, uint32_t> solution;
- if (ScanMidstateForward(ctx, nBits, tx.nTime, tx.vout[nOut].nValue, interval, solution))
+ std::vector<std::pair<uint256, uint32_t> > solutions;
+ if (ScanKernelForward((unsigned char *)&itK[0], nBits, tx.nTime, tx.vout[nOut].nValue, interval, solutions))
{
- Object r;
- r.push_back(Pair("hash", solution.first.GetHex()));
- r.push_back(Pair("time", DateTimeStrFormat(solution.second)));
+ Array results;
+
+ BOOST_FOREACH(const PAIRTYPE(uint256, uint32_t) solution, solutions)
+ {
+
+ Object item;
+ item.push_back(Pair("hash", solution.first.GetHex()));
+ item.push_back(Pair("time", DateTimeStrFormat(solution.second)));
+
+ results.push_back(item);
+ }
- return r;
+ return results;
}
}
else
try {
ssBlock >> block;
}
- catch (std::exception &e) {
+ catch (const std::exception&) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
}