Skip to content

Commit

Permalink
Added a window around current header where state generation is always…
Browse files Browse the repository at this point in the history
… done
  • Loading branch information
gameofpointers committed Oct 30, 2023
1 parent b66bbf3 commit b3e3586
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
c_asyncPhUpdateChanSize = 10
c_phCacheSize = 500
c_pEtxRetryThreshold = 100 // Number of pEtxNotFound return on a dom block before asking for pEtx/Rollup from sub
c_currentStateComputeWindow = 20 // Number of blocks around the current header the state generation is always done
)

type pEtxRetry struct {
Expand Down Expand Up @@ -300,7 +301,7 @@ func (sl *Slice) Append(header *types.Header, domPendingHeader *types.Header, do

setHead = sl.poem(sl.engine.TotalLogS(block.Header()), sl.engine.TotalLogS(sl.hc.CurrentHeader()))

if subReorg {
if subReorg || (sl.hc.CurrentHeader().NumberU64() < block.NumberU64()+c_currentStateComputeWindow) {
err := sl.hc.SetCurrentState(block.Header())
if err != nil {
log.Error("Error setting current state", "err", err, "Hash", block.Hash())
Expand Down

0 comments on commit b3e3586

Please sign in to comment.