mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 07:52:25 +00:00
Merge pull request #1584
990e08f0
Fix PR#1506, off by one in chain height (Howard Chu)
This commit is contained in:
commit
deb6728bc3
1 changed files with 2 additions and 3 deletions
|
@ -128,6 +128,8 @@ uint64_t BlockchainDB::add_block( const block& blk
|
||||||
TIME_MEASURE_FINISH(time1);
|
TIME_MEASURE_FINISH(time1);
|
||||||
time_blk_hash += time1;
|
time_blk_hash += time1;
|
||||||
|
|
||||||
|
uint64_t prev_height = height();
|
||||||
|
|
||||||
// call out to subclass implementation to add the block & metadata
|
// call out to subclass implementation to add the block & metadata
|
||||||
time1 = epee::misc_utils::get_tick_count();
|
time1 = epee::misc_utils::get_tick_count();
|
||||||
add_block(blk, block_size, cumulative_difficulty, coins_generated, blk_hash);
|
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_MEASURE_FINISH(time1);
|
||||||
time_add_transaction += 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);
|
m_hardfork->add(blk, prev_height);
|
||||||
|
|
||||||
block_txn_stop();
|
block_txn_stop();
|
||||||
|
|
Loading…
Reference in a new issue