before getting block, check if it exist using its hash

This commit is contained in:
moneroexamples 2016-12-14 10:28:47 +08:00
parent 9fb47b3cda
commit ede2ad9556

View file

@ -122,6 +122,14 @@ namespace xmreg
return false; return false;
} }
if (!m_blockchain_storage.have_block(block_id))
{
cerr << "Block with hash " << block_id
<< " not found in the blockchain!"
<< endl;
return false;
}
if (!m_blockchain_storage.get_block_by_hash(block_id, blk)) if (!m_blockchain_storage.get_block_by_hash(block_id, blk))
{ {