diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-01-16 08:41:15 -0500 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-01-16 08:41:15 -0500 |
commit | deb6728bc3bb0021d08a7061cdecc21015d6f2a8 (patch) | |
tree | bd863b29a00deba88d1acee469a8dd6d6c1bf650 | |
parent | Merge pull request #1583 (diff) | |
parent | Fix PR#1506, off by one in chain height (diff) | |
download | monero-deb6728bc3bb0021d08a7061cdecc21015d6f2a8.tar.xz |
Merge pull request #1584
990e08f0 Fix PR#1506, off by one in chain height (Howard Chu)
-rw-r--r-- | src/blockchain_db/blockchain_db.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp index a88af2fc9..bd1a38ec3 100644 --- a/src/blockchain_db/blockchain_db.cpp +++ b/src/blockchain_db/blockchain_db.cpp @@ -128,6 +128,8 @@ uint64_t BlockchainDB::add_block( const block& blk TIME_MEASURE_FINISH(time1); time_blk_hash += time1; + 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); @@ -149,9 +151,6 @@ uint64_t BlockchainDB::add_block( const block& blk TIME_MEASURE_FINISH(time1); time_add_transaction += time1; - // DB's new height based on this added block is only incremented after this - // function returns, so height() here returns the new previous height. - uint64_t prev_height = height(); m_hardfork->add(blk, prev_height); block_txn_stop(); |