// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
-#include <map>
+#include "txdb-leveldb.h"
+#include "kernel.h"
+#include "checkpoints.h"
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include <leveldb/filter_policy.h>
#include <memenv/memenv.h>
-#include "kernel.h"
-#include "checkpoints.h"
-#include "txdb-leveldb.h"
-#include "util.h"
-#include "main.h"
-
using namespace std;
-using namespace boost;
leveldb::DB *txdb; // global pointer for LevelDB object instance
// Calculate nChainTrust
vector<pair<int, CBlockIndex*> > vSortedByHeight;
vSortedByHeight.reserve(mapBlockIndex.size());
- BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
+ for (const auto& item : mapBlockIndex)
{
CBlockIndex* pindex = item.second;
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
- BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
+ for (const auto& item : vSortedByHeight)
{
CBlockIndex* pindex = item.second;
pindex->nChainTrust = (pindex->pprev ? pindex->pprev->nChainTrust : 0) + pindex->GetBlockTrust();
{
pair<unsigned int, unsigned int> pos = make_pair(pindex->nFile, pindex->nBlockPos);
mapBlockPos[pos] = pindex;
- BOOST_FOREACH(const CTransaction &tx, block.vtx)
+ for (const CTransaction &tx : block.vtx)
{
uint256 hashTx = tx.GetHash();
CTxIndex txindex;
unsigned int nOutput = 0;
if (nCheckLevel>3)
{
- BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
+ for (const CDiskTxPos &txpos : txindex.vSpent)
{
if (!txpos.IsNull())
{
else
{
bool fFound = false;
- BOOST_FOREACH(const CTxIn &txin, txSpend.vin)
+ for (const CTxIn &txin : txSpend.vin)
if (txin.prevout.hash == hashTx && txin.prevout.n == nOutput)
fFound = true;
if (!fFound)
// check level 5: check whether all prevouts are marked spent
if (nCheckLevel>4)
{
- BOOST_FOREACH(const CTxIn &txin, tx.vin)
+ for (const CTxIn &txin : tx.vin)
{
CTxIndex txindex;
if (ReadTxIndex(txin.prevout.hash, txindex))