Skip to content

Commit

Permalink
ledger: extend catchpoint blocks lookback (#4463)
Browse files Browse the repository at this point in the history
* replaying transactions after catchpoint requires 1001 blocks
  from the very first replayed block
  • Loading branch information
algorandskiy authored Aug 25, 2022
1 parent 5a81d99 commit 00a6150
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions catchup/catchpointService.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,14 @@ func (cs *CatchpointCatchupService) processStageBlocksDownload() (err error) {
return cs.abort(fmt.Errorf("processStageBlocksDownload failed, unable to ensure first block : %v", err))
}

// pick the lookback with the greater of either (MaxTxnLife+DeeperBlockHeaderHistory)
// or MaxBalLookback
// pick the lookback with the greater of
// either (MaxTxnLife+DeeperBlockHeaderHistory+CatchpointLookback) or MaxBalLookback
// Explanation:
// 1. catchpoint snapshots accounts at round X-CatchpointLookback
// 2. replay starts from X-CatchpointLookback+1
// 3. transaction evaluation at Y requires block up to MaxTxnLife+DeeperBlockHeaderHistory back from Y
proto := config.Consensus[topBlock.CurrentProtocol]
lookback := proto.MaxTxnLife + proto.DeeperBlockHeaderHistory
lookback := proto.MaxTxnLife + proto.DeeperBlockHeaderHistory + proto.CatchpointLookback
if lookback < proto.MaxBalLookback {
lookback = proto.MaxBalLookback
}
Expand Down

0 comments on commit 00a6150

Please sign in to comment.