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

Fix bugs in block_log #7188

Merged
merged 1 commit into from
Apr 24, 2019
Merged
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
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