diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -75,9 +75,10 @@ for (std::vector::const_iterator it(vout.begin()); it != vout.end(); ++it) { nValueOut += it->nValue; - if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) + if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) { throw std::runtime_error(std::string(__func__) + ": value out of range"); + } } return nValueOut; } @@ -85,7 +86,9 @@ double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSize) const { nTxSize = CalculateModifiedSize(nTxSize); - if (nTxSize == 0) return 0.0; + if (nTxSize == 0) { + return 0.0; + } return dPriorityInputs / nTxSize; } @@ -97,12 +100,15 @@ // for priority. Providing any more cleanup incentive than making additional // inputs free would risk encouraging people to create junk outputs to // redeem later. - if (nTxSize == 0) nTxSize = GetTotalSize(); - for (std::vector::const_iterator it(vin.begin()); it != vin.end(); - ++it) { + if (nTxSize == 0) { + nTxSize = GetTotalSize(); + } + for (const auto &nVin : vin) { unsigned int offset = - 41U + std::min(110U, (unsigned int)it->scriptSig.size()); - if (nTxSize > offset) nTxSize -= offset; + 41U + std::min(110U, (unsigned int)nVin.scriptSig.size()); + if (nTxSize > offset) { + nTxSize -= offset; + } } return nTxSize; } @@ -117,9 +123,11 @@ "nLockTime=%u)\n", GetId().ToString().substr(0, 10), nVersion, vin.size(), vout.size(), nLockTime); - for (unsigned int i = 0; i < vin.size(); i++) - str += " " + vin[i].ToString() + "\n"; - for (unsigned int i = 0; i < vout.size(); i++) - str += " " + vout[i].ToString() + "\n"; + for (const auto &nVin : vin) { + str += " " + nVin.ToString() + "\n"; + } + for (const auto &nVout : vout) { + str += " " + nVout.ToString() + "\n"; + } return str; }