aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2014-10-10 00:42:03 -0400
committerCory Fields <cory-nospam-@coryfields.com>2014-10-15 15:13:20 -0400
commite1c946776652a177e3b46db02391263cc24bfd5a (patch)
treeab42f4635f06f3fd7bc45d75a1fe7d22c4329d8b
parente405aa48c7221017467f50daf29ff6794c76332d (diff)
boost: drop boost dependency in core.cpp
-rw-r--r--src/core.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/core.cpp b/src/core.cpp
index 380b1c38e0..6a7a9ff378 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -7,8 +7,6 @@
#include "tinyformat.h"
-#include <boost/foreach.hpp>
-
std::string COutPoint::ToString() const
{
return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n);
@@ -113,10 +111,10 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) {
CAmount CTransaction::GetValueOut() const
{
CAmount nValueOut = 0;
- BOOST_FOREACH(const CTxOut& txout, vout)
+ for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); ++it)
{
- nValueOut += txout.nValue;
- if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut))
+ nValueOut += it->nValue;
+ if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut))
throw std::runtime_error("CTransaction::GetValueOut() : value out of range");
}
return nValueOut;
@@ -139,10 +137,9 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const
// risk encouraging people to create junk outputs to redeem later.
if (nTxSize == 0)
nTxSize = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
-
- BOOST_FOREACH(const CTxIn& txin, vin)
+ for (std::vector<CTxIn>::const_iterator it(vin.begin()); it != vin.end(); ++it)
{
- unsigned int offset = 41U + std::min(110U, (unsigned int)txin.scriptSig.size());
+ unsigned int offset = 41U + std::min(110U, (unsigned int)it->scriptSig.size());
if (nTxSize > offset)
nTxSize -= offset;
}
@@ -263,8 +260,8 @@ uint256 CBlock::BuildMerkleTree(bool* fMutated) const
*/
vMerkleTree.clear();
vMerkleTree.reserve(vtx.size() * 2 + 16); // Safe upper bound for the number of total nodes.
- BOOST_FOREACH(const CTransaction& tx, vtx)
- vMerkleTree.push_back(tx.GetHash());
+ for (std::vector<CTransaction>::const_iterator it(vtx.begin()); it != vtx.end(); ++it)
+ vMerkleTree.push_back(it->GetHash());
int j = 0;
bool mutated = false;
for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
@@ -307,12 +304,12 @@ uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMer
{
if (nIndex == -1)
return 0;
- BOOST_FOREACH(const uint256& otherside, vMerkleBranch)
+ for (std::vector<uint256>::const_iterator it(vMerkleBranch.begin()); it != vMerkleBranch.end(); ++it)
{
if (nIndex & 1)
- hash = Hash(BEGIN(otherside), END(otherside), BEGIN(hash), END(hash));
+ hash = Hash(BEGIN(*it), END(*it), BEGIN(hash), END(hash));
else
- hash = Hash(BEGIN(hash), END(hash), BEGIN(otherside), END(otherside));
+ hash = Hash(BEGIN(hash), END(hash), BEGIN(*it), END(*it));
nIndex >>= 1;
}
return hash;