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 - v1.7.x #7202

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 @@ -142,7 +142,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) {
ilog("Index is nonempty");
Expand Down Expand Up @@ -314,6 +318,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