aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwarptangent <warptangent@inbox.com>2015-01-11 16:59:59 -0800
committerwarptangent <warptangent@inbox.com>2015-01-11 19:57:46 -0800
commit1701c267502c32af64212d8e496cbdb6f3bc00df (patch)
treed49e76241a2d4b683d3129d37263c3126b03c480
parentMerge pull request #20 from warptangent/fix_transfers (diff)
downloadmonero-1701c267502c32af64212d8e496cbdb6f3bc00df.tar.xz
Use block index when obtaining block's difficulty for log statement
Use last block id, not number of blocks (off-by-one error). Fixes error at start of blockchain reorganization: "Attempt to get cumulative difficulty from height <XXXXXX> failed -- difficulty not in db"
-rw-r--r--src/cryptonote_core/blockchain.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 48e6543ed..2a8eb6721 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1216,8 +1216,8 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
{
//do reorganize!
LOG_PRINT_GREEN("###### REORGANIZE on height: "
- << alt_chain.front()->second.height << " of " << m_db->height()
- << " with cum_difficulty " << m_db->get_block_cumulative_difficulty(m_db->height())
+ << alt_chain.front()->second.height << " of " << m_db->height() - 1
+ << " with cum_difficulty " << m_db->get_block_cumulative_difficulty(m_db->height() - 1)
<< std::endl << " alternative blockchain size: " << alt_chain.size()
<< " with cum_difficulty " << bei.cumulative_difficulty, LOG_LEVEL_0
);