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.
This commit is contained in:
parent
63051bea1c
commit
0840c2fd7e
@ -1113,7 +1113,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
|
|||||||
if(alt_chain.size())
|
if(alt_chain.size())
|
||||||
{
|
{
|
||||||
// make sure alt chain doesn't somehow start past the end of the main chain
|
// 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
|
// make sure that the blockchain contains the block that should connect
|
||||||
// this alternate chain with it.
|
// this alternate chain with it.
|
||||||
|
Loading…
Reference in New Issue
Block a user