Skip to content

Commit a3e1984

Browse files
committed
Consensus: Trivial transform BOOST_FOREACH into for loop
1 parent bc94b87 commit a3e1984

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
785785
return true;
786786
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
787787
return true;
788-
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
788+
for (const auto& txin : tx.vin) {
789789
if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL))
790790
return false;
791791
}
@@ -999,11 +999,11 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
999999
unsigned int GetLegacySigOpCount(const CTransaction& tx)
10001000
{
10011001
unsigned int nSigOps = 0;
1002-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1002+
for (const auto& txin : tx.vin)
10031003
{
10041004
nSigOps += txin.scriptSig.GetSigOpCount(false);
10051005
}
1006-
BOOST_FOREACH(const CTxOut& txout, tx.vout)
1006+
for (const auto& txout : tx.vout)
10071007
{
10081008
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
10091009
}
@@ -1061,7 +1061,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
10611061

10621062
// Check for negative or overflow output values
10631063
CAmount nValueOut = 0;
1064-
BOOST_FOREACH(const CTxOut& txout, tx.vout)
1064+
for (const auto& txout : tx.vout)
10651065
{
10661066
if (txout.nValue < 0)
10671067
return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-negative");
@@ -1074,7 +1074,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
10741074

10751075
// Check for duplicate inputs
10761076
set<COutPoint> vInOutPoints;
1077-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1077+
for (const auto& txin : tx.vin)
10781078
{
10791079
if (vInOutPoints.count(txin.prevout))
10801080
return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputs-duplicate");
@@ -1088,7 +1088,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
10881088
}
10891089
else
10901090
{
1091-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1091+
for (const auto& txin : tx.vin)
10921092
if (txin.prevout.IsNull())
10931093
return state.DoS(10, false, REJECT_INVALID, "bad-txns-prevout-null");
10941094
}
@@ -3401,13 +3401,13 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
34013401
return state.DoS(100, false, REJECT_INVALID, "bad-cb-multiple", false, "more than one coinbase");
34023402

34033403
// Check transactions
3404-
BOOST_FOREACH(const CTransaction& tx, block.vtx)
3404+
for (const auto& tx : block.vtx)
34053405
if (!CheckTransaction(tx, state))
34063406
return state.Invalid(false, state.GetRejectCode(), state.GetRejectReason(),
34073407
strprintf("Transaction check failed (tx hash %s) %s", tx.GetHash().ToString(), state.GetDebugMessage()));
34083408

34093409
unsigned int nSigOps = 0;
3410-
BOOST_FOREACH(const CTransaction& tx, block.vtx)
3410+
for (const auto& tx : block.vtx)
34113411
{
34123412
nSigOps += GetLegacySigOpCount(tx);
34133413
}
@@ -3538,7 +3538,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
35383538
: block.GetBlockTime();
35393539

35403540
// Check that all transactions are finalized
3541-
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
3541+
for (const auto& tx : block.vtx) {
35423542
if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) {
35433543
return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, "non-final transaction");
35443544
}

0 commit comments

Comments
 (0)