Skip to content

Commit 6f4092d

Browse files
committed
Merge #8342: Consensus: Trivial transform BOOST_FOREACH into for loop
a3e1984 Consensus: Trivial transform BOOST_FOREACH into for loop (NicolasDorier)
2 parents 8e048f4 + a3e1984 commit 6f4092d

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
@@ -788,7 +788,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
788788
return true;
789789
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
790790
return true;
791-
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
791+
for (const auto& txin : tx.vin) {
792792
if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL))
793793
return false;
794794
}
@@ -1002,11 +1002,11 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
10021002
unsigned int GetLegacySigOpCount(const CTransaction& tx)
10031003
{
10041004
unsigned int nSigOps = 0;
1005-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1005+
for (const auto& txin : tx.vin)
10061006
{
10071007
nSigOps += txin.scriptSig.GetSigOpCount(false);
10081008
}
1009-
BOOST_FOREACH(const CTxOut& txout, tx.vout)
1009+
for (const auto& txout : tx.vout)
10101010
{
10111011
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
10121012
}
@@ -1064,7 +1064,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
10641064

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

10781078
// Check for duplicate inputs
10791079
set<COutPoint> vInOutPoints;
1080-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1080+
for (const auto& txin : tx.vin)
10811081
{
10821082
if (vInOutPoints.count(txin.prevout))
10831083
return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputs-duplicate");
@@ -1091,7 +1091,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
10911091
}
10921092
else
10931093
{
1094-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
1094+
for (const auto& txin : tx.vin)
10951095
if (txin.prevout.IsNull())
10961096
return state.DoS(10, false, REJECT_INVALID, "bad-txns-prevout-null");
10971097
}
@@ -3404,13 +3404,13 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
34043404
return state.DoS(100, false, REJECT_INVALID, "bad-cb-multiple", false, "more than one coinbase");
34053405

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

34123412
unsigned int nSigOps = 0;
3413-
BOOST_FOREACH(const CTransaction& tx, block.vtx)
3413+
for (const auto& tx : block.vtx)
34143414
{
34153415
nSigOps += GetLegacySigOpCount(tx);
34163416
}
@@ -3541,7 +3541,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
35413541
: block.GetBlockTime();
35423542

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

0 commit comments

Comments
 (0)