Skip to content

Commit

Permalink
Only log old block if going to propose
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Oct 3, 2024
1 parent ef3d011 commit ffde4fd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions op-proposer/proposer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,16 @@ func (l *L2OutputSubmitter) generateNextProposal(ctx context.Context, lastPropos
}
}

latestBlockHeader, err := l.L2Client.HeaderByNumber(l.ctx, nil)
if err != nil {
log.Warn("Failed to get latest block header", "err", err)
shouldPropose = false
} else if lastProposal.BlockRef.Number <= latestBlockHeader.Number.Uint64()-256 {
// only submit onchain if within the blockhash window
log.Warn("Not submitting proposal, block is too old", "block", lastProposal.BlockRef.Number, "latest", latestBlockHeader.Number.Uint64())
shouldPropose = false
if shouldPropose {
latestBlockHeader, err := l.L2Client.HeaderByNumber(l.ctx, nil)
if err != nil {
log.Warn("Failed to get latest block header", "err", err)
shouldPropose = false
} else if lastProposal.BlockRef.Number <= latestBlockHeader.Number.Uint64()-256 {
// only submit onchain if within the blockhash window
log.Warn("Not submitting proposal, block is too old", "block", lastProposal.BlockRef.Number, "latest", latestBlockHeader.Number.Uint64())
shouldPropose = false
}
}

return lastProposal, shouldPropose, nil
Expand Down

0 comments on commit ffde4fd

Please sign in to comment.