Skip to content

Commit

Permalink
Used c++11 for
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey committed Oct 4, 2019
1 parent 7a9012e commit c57d9c5
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/txdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,15 @@ void CDbIndexHelper::ConnectTransaction(CTransaction const & tx, int height, int
{
size_t no = 0;
if(!tx.IsCoinBase() && !tx.IsZerocoinSpend() && !tx.IsSigmaSpend() && !tx.IsZerocoinRemint()) {
for (std::vector<CTxIn>::const_iterator iter = tx.vin.begin(); iter != tx.vin.end(); ++iter) {
CTxIn const & input = *iter;
for (CTxIn const & input : tx.vin) {
handleInput(input, no++, tx.GetHash(), height, txNumber, view, addressIndex, addressUnspentIndex, spentIndex);
}
}

if(tx.IsZerocoinRemint()) {
CAmount remintValue = 0;
for (std::vector<CTxOut>::const_iterator iter_out = tx.vout.begin(); iter_out != tx.vout.end(); ++iter_out) {
remintValue += iter_out->nValue;
for (CTxOut const & out : tx.vout) {
remintValue += out.nValue;
}
if (tx.vin.size() != 1) {
error("A Zerocoin to Sigma remint tx shoud have just 1 input");
Expand All @@ -576,8 +575,7 @@ void CDbIndexHelper::ConnectTransaction(CTransaction const & tx, int height, int

no = 0;
bool const txIsCoinBase = tx.IsCoinBase();
for (std::vector<CTxOut>::const_iterator iter = tx.vout.begin(); iter != tx.vout.end(); ++iter) {
CTxOut const & out = *iter;
for (CTxOut const & out : tx.vout) {
handleOutput(out, no++, tx.GetHash(), height, txNumber, view, txIsCoinBase, addressIndex, addressUnspentIndex, spentIndex);
}
}
Expand All @@ -597,8 +595,8 @@ void CDbIndexHelper::DisconnectTransactionInputs(CTransaction const & tx, int he

if(tx.IsZerocoinRemint()) {
CAmount remintValue = 0;
for (std::vector<CTxOut>::const_iterator iter_out = tx.vout.begin(); iter_out != tx.vout.end(); ++iter_out) {
remintValue += iter_out->nValue;
for (CTxOut const & out : tx.vout) {
remintValue += out.nValue;
}
if (tx.vin.size() != 1) {
error("A Zerocoin to Sigma remint tx shoud have just 1 input");
Expand All @@ -610,8 +608,7 @@ void CDbIndexHelper::DisconnectTransactionInputs(CTransaction const & tx, int he
size_t no = 0;

if(!tx.IsCoinBase() && !tx.IsZerocoinSpend() && !tx.IsSigmaSpend() && !tx.IsZerocoinRemint())
for (std::vector<CTxIn>::const_iterator iter = tx.vin.begin(); iter != tx.vin.end(); ++iter) {
CTxIn const & input = *iter;
for (CTxIn const & input : tx.vin) {
handleInput(input, no++, tx.GetHash(), height, txNumber, view, addressIndex, addressUnspentIndex, spentIndex);
}

Expand All @@ -634,8 +631,7 @@ void CDbIndexHelper::DisconnectTransactionOutputs(CTransaction const & tx, int h

size_t no = 0;
bool const txIsCoinBase = tx.IsCoinBase();
for (std::vector<CTxOut>::const_iterator iter = tx.vout.begin(); iter != tx.vout.end(); ++iter) {
CTxOut const & out = *iter;
for (CTxOut const & out : tx.vout) {
handleOutput(out, no++, tx.GetHash(), height, txNumber, view, txIsCoinBase, addressIndex, addressUnspentIndex, spentIndex);
}

Expand Down

0 comments on commit c57d9c5

Please sign in to comment.