aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db
diff options
context:
space:
mode:
Diffstat (limited to 'src/blockchain_db')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 4a4550179..84d8cd59e 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -722,15 +722,15 @@ void BlockchainLMDB::remove_tx_outputs(const crypto::hash& tx_hash, const transa
size_t num_elems = 0;
mdb_cursor_count(cur, &num_elems);
- mdb_cursor_get(cur, &k, &v, MDB_FIRST_DUP);
+ mdb_cursor_get(cur, &k, &v, MDB_LAST_DUP);
- for (uint64_t i = 0; i < num_elems; ++i)
+ for (uint64_t i = num_elems; i > 0; --i)
{
- const tx_out tx_output = tx.vout[i];
+ const tx_out tx_output = tx.vout[i-1];
remove_output(*(const uint64_t*)v.mv_data, tx_output.amount);
- if (i < num_elems - 1)
+ if (i > 1)
{
- mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
+ mdb_cursor_get(cur, &k, &v, MDB_PREV_DUP);
}
}
}