Skip to content

Commit

Permalink
fix: snapshot generation issue after chain reinit from a freezer (#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
brilliant-lx authored Mar 29, 2023
1 parent ece84d4 commit 7552953
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,10 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash
}
}

// If we're at the genesis, snapshot the initial state.
if number == 0 {
// If we're at the genesis, snapshot the initial state. Alternatively if we have
// piled up more headers than allowed to be reorged (chain reinit from a freezer),
// consider the checkpoint trusted and snapshot it.
if number == 0 || (number%p.config.Epoch == 0 && (len(headers) > params.FullImmutabilityThreshold)) {
checkpoint := chain.GetHeaderByNumber(number)
if checkpoint != nil {
// get checkpoint data
Expand Down

0 comments on commit 7552953

Please sign in to comment.