Skip to content

Commit 48a0625

Browse files
author
colinlyguo
committed
tweaks
1 parent 7e688e8 commit 48a0625

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

rollup/internal/controller/watcher/chunk_proposer.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,18 @@ func (p *ChunkProposer) recordTimerChunkMetrics(metrics *utils.ChunkMetrics) {
449449
}
450450

451451
func (p *ChunkProposer) tryProposeEuclidTransitionChunk(blocks []*encoding.Block) (bool, error) {
452+
// If we are in replay mode, there is a corner case when StartL2Block is set as 0 in this check,
453+
// it needs to get genesis block, but in mainnet db there is no genesis block, so we need to bypass this check.
454+
if p.replayMode {
455+
return false, nil
456+
}
457+
452458
if !p.chainCfg.IsEuclid(blocks[0].Header.Time) {
453459
return false, nil
454460
}
455461

456462
prevBlocks, err := p.l2BlockOrm.GetL2BlocksGEHeight(p.ctx, blocks[0].Header.Number.Uint64()-1, 1)
457-
// If we are in replay mode, we don't need to check the parent block.
458-
// This is a corner case when StartL2Block is set as 0, it needs to get genesis block, but in mainnet db there is no genesis block.
459-
// So we need to bypass this check.
460-
if !p.replayMode && (err != nil || len(prevBlocks) == 0 || prevBlocks[0].Header.Hash() != blocks[0].Header.ParentHash) {
463+
if err != nil || len(prevBlocks) == 0 || prevBlocks[0].Header.Hash() != blocks[0].Header.ParentHash {
461464
return false, fmt.Errorf("failed to get parent block: %w", err)
462465
}
463466

0 commit comments

Comments
 (0)