aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorwarptangent <warptangent@inbox.com>2015-01-11 19:07:27 -0800
committerwarptangent <warptangent@inbox.com>2015-01-11 21:23:02 -0800
commit0840c2fd7eb28aabcf793c2ec59824fd354a936c (patch)
tree5fa2c9f939cfbe73d65097577939cc560bd5d925 /src/cryptonote_core
parentFix comparison between main and alternate chain's cumulative (diff)
downloadmonero-0840c2fd7eb28aabcf793c2ec59824fd354a936c.tar.xz
Fix height assertion in Blockchain::handle_alternative_block()
It expects the total number of blocks of main chain, not last block id (off-by-one error). This again behaves like the same height assertion done in original implementation in blockchain_storage::handle_alternative_block(). This allows a reorganization to proceed after an alternative block has been added.
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index c052e3944..4fa868abe 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1113,7 +1113,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
if(alt_chain.size())
{
// make sure alt chain doesn't somehow start past the end of the main chain
- CHECK_AND_ASSERT_MES(m_db->height() - 1 > alt_chain.front()->second.height, false, "main blockchain wrong height");
+ CHECK_AND_ASSERT_MES(m_db->height() > alt_chain.front()->second.height, false, "main blockchain wrong height");
// make sure that the blockchain contains the block that should connect
// this alternate chain with it.