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

Commit

Permalink
Merge pull request #7188 from EOSIO/fix-block-log-bugs
Browse files Browse the repository at this point in the history
Fix bugs in block_log
  • Loading branch information
arhag committed Apr 24, 2019
2 parents eb2f686 + 80f4551 commit 4547a51
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ namespace eosio { namespace chain {
}

my->head = read_head();
my->head_id = my->head->id();
if( my->head ) {
my->head_id = my->head->id();
} else {
my->head_id = {};
}

if (index_size) {
my->check_block_read();
Expand Down Expand Up @@ -341,6 +345,12 @@ namespace eosio { namespace chain {

my->block_stream.seekg(-sizeof( uint64_t), std::ios::end);
my->block_stream.read((char*)&end_pos, sizeof(end_pos));

if( end_pos == npos ) {
ilog( "Block log contains no blocks. No need to construct index." );
return;
}

signed_block tmp;

uint64_t pos = 0;
Expand Down

0 comments on commit 4547a51

Please sign in to comment.