aboutsummaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2014-10-15 12:39:33 -0700
committerPieter Wuille <[email protected]>2014-10-15 12:43:16 -0700
commite8f6d54f1f58d9a5998e37367b84b427e51e1ad7 (patch)
tree8b40c5a3f4e10c1951a9fc7d327e15cbc632c8f2 /src/core.cpp
parentMerge pull request #4942 (diff)
parentboost: drop boost dependency in version.cpp. (diff)
downloaddiscoin-e8f6d54f1f58d9a5998e37367b84b427e51e1ad7.tar.xz
discoin-e8f6d54f1f58d9a5998e37367b84b427e51e1ad7.zip
Merge pull request #5082
5f4bcf6 boost: drop boost dependency in version.cpp. (Cory Fields) 352058e boost: drop boost dependency in utilstrencodings.cpp (Cory Fields) e1c9467 boost: drop boost dependency in core.cpp (Cory Fields) e405aa4 boost: remove CPrivKey dependency from CECKey (Cory Fields) 5295506 boost: drop dependency on tuple in serialization (Cory Fields) 1d9b86d boost: drop dependency on is_fundamental in serialization (Cory Fields)
Diffstat (limited to 'src/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 380b1c38e..6a7a9ff37 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;