aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-02-12 23:23:46 +0200
committerRiccardo Spagni <ric@spagni.net>2017-02-12 23:23:46 +0200
commit6a261fa1bc8da4443e0dbb06689e1284cbf07155 (patch)
tree56343ae933683460f9887811c0e0d7ac6fd13584
parentMerge pull request #1706 (diff)
parentdb_lmdb: fix bad height saved in tx data (diff)
downloadmonero-6a261fa1bc8da4443e0dbb06689e1284cbf07155.tar.xz
Merge pull request #1708
f2986ccf db_lmdb: fix bad height saved in tx data (moneromooo-monero)
-rw-r--r--src/blockchain_db/blockchain_db.cpp12
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp1
2 files changed, 7 insertions, 6 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index 1cb0ada0c..7ac046bc9 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -130,12 +130,6 @@ uint64_t BlockchainDB::add_block( const block& blk
uint64_t prev_height = height();
- // call out to subclass implementation to add the block & metadata
- time1 = epee::misc_utils::get_tick_count();
- add_block(blk, block_size, cumulative_difficulty, coins_generated, blk_hash);
- TIME_MEASURE_FINISH(time1);
- time_add_block1 += time1;
-
// call out to add the transactions
time1 = epee::misc_utils::get_tick_count();
@@ -151,6 +145,12 @@ uint64_t BlockchainDB::add_block( const block& blk
TIME_MEASURE_FINISH(time1);
time_add_transaction += time1;
+ // call out to subclass implementation to add the block & metadata
+ time1 = epee::misc_utils::get_tick_count();
+ add_block(blk, block_size, cumulative_difficulty, coins_generated, blk_hash);
+ TIME_MEASURE_FINISH(time1);
+ time_add_block1 += time1;
+
m_hardfork->add(blk, prev_height);
block_txn_stop();
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 863f54246..0a35325e4 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -628,6 +628,7 @@ void BlockchainLMDB::add_block(const block& blk, const size_t& block_size, const
CURSOR(blocks)
CURSOR(block_info)
+ // this call to mdb_cursor_put will change height()
MDB_val_copy<blobdata> blob(block_to_blob(blk));
result = mdb_cursor_put(m_cur_blocks, &key, &blob, MDB_APPEND);
if (result)