Skip to content

Commit

Permalink
Merge pull request #145 from LetheanMovement/hotfix/pallas/block_dne
Browse files Browse the repository at this point in the history
Fix for unknown block crash
  • Loading branch information
iedemam committed Nov 1, 2018
2 parents 585fb4d + 0739ddc commit b920c7b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/cryptonote_core/blockchain.cpp
Expand Up @@ -1964,16 +1964,19 @@ bool Blockchain::get_blocks(const t_ids_container& block_ids, t_blocks_container
{
try
{
blocks.push_back(std::make_pair(m_db->get_block_blob(block_hash), block()));
if (!parse_and_validate_block_from_blob(blocks.back().first, blocks.back().second))
uint64_t height = 0;
if (m_db->block_exists(block_hash, &height))
{
LOG_ERROR("Invalid block");
return false;
blocks.push_back(std::make_pair(m_db->get_block_blob_from_height(height), block()));
if (!parse_and_validate_block_from_blob(blocks.back().first, blocks.back().second))
{
LOG_ERROR("Invalid block: " << block_hash);
blocks.pop_back();
missed_bs.push_back(block_hash);
}
}
}
catch (const BLOCK_DNE& e)
{
missed_bs.push_back(block_hash);
else
missed_bs.push_back(block_hash);
}
catch (const std::exception& e)
{
Expand Down

0 comments on commit b920c7b

Please sign in to comment.