Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Sep 5, 2024
1 parent 0379e63 commit eb5a388
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions miner/scroll_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,18 +849,16 @@ func (w *worker) commit(force bool) (common.Hash, error) {
)
}

ancestorHeight := uint64(1)
currentHeight := w.current.header.Number.Uint64()
maxReorgDepth := uint64(w.config.CCCMaxWorkers + 1)
if currentHeight > maxReorgDepth {
ancestorHeight = currentHeight - maxReorgDepth
}

ancestorHash := w.chain.GetHeaderByNumber(ancestorHeight).Hash()
if rawdb.ReadBlockRowConsumption(w.chain.Database(), ancestorHash) == nil {
// reject committing to a block if its ancestor doesn't have its RC stored in DB yet.
// which may either mean that it failed CCC or it is still in the process of being checked
return common.Hash{}, retryableCommitError{inner: errors.New("ancestor doesn't have RC yet")}
ancestorHeight := currentHeight - maxReorgDepth
ancestorHash := w.chain.GetHeaderByNumber(ancestorHeight).Hash()
if rawdb.ReadBlockRowConsumption(w.chain.Database(), ancestorHash) == nil {
// reject committing to a block if its ancestor doesn't have its RC stored in DB yet.
// which may either mean that it failed CCC or it is still in the process of being checked
return common.Hash{}, retryableCommitError{inner: errors.New("ancestor doesn't have RC yet")}
}
}

// A new block event will trigger a reorg in the txpool, pause reorgs to defer this until we fetch txns for next block.
Expand Down

0 comments on commit eb5a388

Please sign in to comment.