Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

app shutdown when corrupt blocks during reconstruction #7187

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,12 @@ namespace eosio { namespace chain {
}

while( pos < end_pos ) {
fc::raw::unpack(my->block_stream, tmp);
try {
fc::raw::unpack(my->block_stream, tmp);
} catch( const fc::assert_exception& ex) {
elog("Failed to unpack block log. Block log is corrupt: ${ex}", ("ex", ex.what()));
throw ex;
}
my->block_stream.read((char*)&pos, sizeof(pos));
if(tmp.block_num() % 1000 == 0)
ilog( "Block log index reconstructed for block ${n}", ("n", tmp.block_num()));
Expand Down
4 changes: 3 additions & 1 deletion plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ bool chain_plugin::recover_reversible_blocks( const fc::path& db_dir, uint32_t c
auto itr = ubi.rbegin();
if( itr != ubi.rend() && itr->blocknum <= truncate_at_block )
return false; // Because we are not going to be truncating the reversible database at all.
} catch( const std::runtime_error& ) {
} catch( const std::runtime_error& e) {
elog("${ex}", ("ex", e.what()));
app().quit();
} catch( ... ) {
throw;
}
Expand Down