#include <boost/filesystem.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
-#include <ostream>
using namespace json_spirit;
using namespace std;
-extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, json_spirit::Object& entry);
+extern void TxToJSON(const CTransaction& tx, const uint256& hashBlock, json_spirit::Object& entry);
extern enum Checkpoints::CPMode CheckpointsMode;
double GetDifficulty(const CBlockIndex* blockindex)
double dStakeKernelsTriedAvg = 0;
int nStakesHandled = 0, nStakesTime = 0;
- CBlockIndex* pindex = pindexBest;;
+ CBlockIndex* pindex = pindexBest;
CBlockIndex* pindexPrevStake = NULL;
while (pindex && nStakesHandled < nPoSInterval)
Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool fPrintTransactionDetail)
{
Object result;
- result.push_back(Pair("hash", block.GetHash().GetHex()));
+ result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
CMerkleTx txGen(block.vtx[0]);
txGen.SetMerkleBranch(&block);
result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
result.push_back(Pair("modifier", strprintf("%016" PRIx64, blockindex->nStakeModifier)));
result.push_back(Pair("modifierchecksum", strprintf("%08x", blockindex->nStakeModifierChecksum)));
Array txinfo;
- BOOST_FOREACH (const CTransaction& tx, block.vtx)
+ for (const CTransaction& tx : block.vtx)
{
if (fPrintTransactionDetail)
{
mempool.queryHashes(vtxid);
Array a;
- BOOST_FOREACH(const uint256& hash, vtxid)
+ for (const uint256& hash : vtxid)
a.push_back(hash.ToString());
return a;
pathDest /= strBlockHash;
try {
- boost::iostreams::stream_buffer<boost::iostreams::file_sink> buf(pathDest.c_str());
+ boost::iostreams::stream_buffer<boost::iostreams::file_sink> buf(pathDest.string());
ostream exportStream(&buf);
exportStream << HexStr(ssBlock.begin(), ssBlock.end());
exportStream.flush();