Commit a9da94ef authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #2040 from ethereum-optimism/fix/bn-monotonicity-log

l2geth: fix monotonicity logging bug
parents 86a70953 c7569a16
---
'@eth-optimism/l2geth': patch
---
Fix blocknumber monotonicity logging bug
...@@ -838,12 +838,13 @@ func (s *SyncService) applyTransactionToTip(tx *types.Transaction) error { ...@@ -838,12 +838,13 @@ func (s *SyncService) applyTransactionToTip(tx *types.Transaction) error {
// Set the L1 blocknumber // Set the L1 blocknumber
if l1BlockNumber == nil { if l1BlockNumber == nil {
tx.SetL1BlockNumber(bn) tx.SetL1BlockNumber(bn)
} else if l1BlockNumber.Uint64() > s.GetLatestL1BlockNumber() { } else if l1BlockNumber.Uint64() > bn {
s.SetLatestL1BlockNumber(l1BlockNumber.Uint64()) s.SetLatestL1BlockNumber(l1BlockNumber.Uint64())
} else { } else if l1BlockNumber.Uint64() < bn {
// l1BlockNumber < latest l1BlockNumber // l1BlockNumber < latest l1BlockNumber
// indicates an error // indicates an error
log.Error("Blocknumber monotonicity violation", "hash", tx.Hash().Hex()) log.Error("Blocknumber monotonicity violation", "hash", tx.Hash().Hex(),
"new", l1BlockNumber.Uint64(), "old", bn)
} }
// Store the latest timestamp value // Store the latest timestamp value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment