Skip to content

Commit

Permalink
fix bug in loading old version snapshots.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldcold authored and VincentOCL committed Jun 3, 2019
1 parent fd444d2 commit a63265f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ namespace eosio { namespace chain {
fc::raw::unpack(tmp_ds, data);
auto original_data_length = tmp_ds.tellp() - 4;
in.seekg(original_data_length);
data.pbft_stable_checkpoint_blocknum = 0;
}else{
fc::raw::unpack(in, data);
}
Expand Down
6 changes: 4 additions & 2 deletions libraries/chain/pbft_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,11 @@ namespace eosio {

if (prepare_watermarks.empty()) return 0;

auto cw = *std::upper_bound(prepare_watermarks.begin(), prepare_watermarks.end(), lib);
auto cw = std::upper_bound(prepare_watermarks.begin(), prepare_watermarks.end(), lib);

if (cw > lib) return cw; else return 0;
if (cw == prepare_watermarks.end() || *cw <= lib) return 0;

return *cw;
}

void pbft_database::update_fork_schedules() {
Expand Down

0 comments on commit a63265f

Please sign in to comment.