aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-12-31 16:35:48 -0500
committerwarptangent <warptangent@inbox.com>2015-01-04 19:39:43 -0800
commit4fa1a83f6e554670eb82a2611922eb995d8a7a65 (patch)
tree3f9aff3ba74e2aeae89d01266a50af774e4cfa7b /src/cryptonote_core
parentFixes a bug with getting output metadata from BlockchainDB (diff)
parentdb_lmdb: fix global index calculation off by 1 (diff)
downloadmonero-4fa1a83f6e554670eb82a2611922eb995d8a7a65.tar.xz
Merge pull request #18 from moneromooo-monero/blockchain
Blockchain
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
index e96b9f90f..5b71dcf08 100644
--- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
+++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
@@ -1162,12 +1162,9 @@ tx_out BlockchainLMDB::get_output(const crypto::hash& h, const uint64_t& index)
mdb_cursor_get(cur, &k, &v, MDB_FIRST_DUP);
- if (index != 0)
+ for (uint64_t i = 0; i < index; ++i)
{
- for (uint64_t i = 0; i < index; ++i)
- {
- mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
- }
+ mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
}
mdb_cursor_get(cur, &k, &v, MDB_GET_CURRENT);
@@ -1264,12 +1261,9 @@ tx_out_index BlockchainLMDB::get_output_tx_and_index(const uint64_t& amount, con
mdb_cursor_get(cur, &k, &v, MDB_FIRST_DUP);
- if (index != 0)
+ for (uint64_t i = 0; i < index; ++i)
{
- for (uint64_t i = 0; i < index; ++i)
- {
- mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
- }
+ mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
}
mdb_cursor_get(cur, &k, &v, MDB_GET_CURRENT);
@@ -1310,9 +1304,9 @@ std::vector<uint64_t> BlockchainLMDB::get_tx_output_indices(const crypto::hash&
for (uint64_t i = 0; i < num_elems; ++i)
{
- mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
mdb_cursor_get(cur, &k, &v, MDB_GET_CURRENT);
index_vec.push_back(*(const uint64_t *)v.mv_data);
+ mdb_cursor_get(cur, &k, &v, MDB_NEXT_DUP);
}
cur.close();