Use range-based for loops (C++11) when looping over vector elements
This commit is contained in:
@@ -1781,8 +1781,8 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const
|
||||
{
|
||||
CMutableTransaction tx1 = *this->tx;
|
||||
CMutableTransaction tx2 = *_tx.tx;
|
||||
for (unsigned int i = 0; i < tx1.vin.size(); i++) tx1.vin[i].scriptSig = CScript();
|
||||
for (unsigned int i = 0; i < tx2.vin.size(); i++) tx2.vin[i].scriptSig = CScript();
|
||||
for (auto& txin : tx1.vin) txin.scriptSig = CScript();
|
||||
for (auto& txin : tx2.vin) txin.scriptSig = CScript();
|
||||
return CTransaction(tx1) == CTransaction(tx2);
|
||||
}
|
||||
|
||||
@@ -2183,10 +2183,10 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
|
||||
|
||||
if (nTotalLower == nTargetValue)
|
||||
{
|
||||
for (unsigned int i = 0; i < vValue.size(); ++i)
|
||||
for (const auto& input : vValue)
|
||||
{
|
||||
setCoinsRet.insert(vValue[i]);
|
||||
nValueRet += vValue[i].txout.nValue;
|
||||
setCoinsRet.insert(input);
|
||||
nValueRet += input.txout.nValue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -2316,7 +2316,7 @@ bool CWallet::SignTransaction(CMutableTransaction &tx)
|
||||
// sign the new tx
|
||||
CTransaction txNewConst(tx);
|
||||
int nIn = 0;
|
||||
for (auto& input : tx.vin) {
|
||||
for (const auto& input : tx.vin) {
|
||||
std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash);
|
||||
if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) {
|
||||
return false;
|
||||
@@ -3258,11 +3258,11 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
|
||||
}
|
||||
|
||||
// group lone addrs by themselves
|
||||
for (unsigned int i = 0; i < pcoin->tx->vout.size(); i++)
|
||||
if (IsMine(pcoin->tx->vout[i]))
|
||||
for (const auto& txout : pcoin->tx->vout)
|
||||
if (IsMine(txout))
|
||||
{
|
||||
CTxDestination address;
|
||||
if(!ExtractDestination(pcoin->tx->vout[i].scriptPubKey, address))
|
||||
if(!ExtractDestination(txout.scriptPubKey, address))
|
||||
continue;
|
||||
grouping.insert(address);
|
||||
groupings.insert(grouping);
|
||||
|
||||
Reference in New Issue
Block a user