Commit c7569a16 authored by Mark Tyneway's avatar Mark Tyneway

l2geth: fix monotonicity logging bug

The logline `Blocknumber monotonicity violation`
was being logged erroneously. This commit ensures
that it is not logged when it doesn't need to be
logged.

It would previously log if the L1 blocknumber
was equal to or less than and now it only logs
if the L1 blocknumber is less than.
parent b64c2721
---
'@eth-optimism/l2geth': patch
---
Fix blocknumber monotonicity logging bug
......@@ -838,12 +838,13 @@ func (s *SyncService) applyTransactionToTip(tx *types.Transaction) error {
// Set the L1 blocknumber
if l1BlockNumber == nil {
tx.SetL1BlockNumber(bn)
} else if l1BlockNumber.Uint64() > s.GetLatestL1BlockNumber() {
} else if l1BlockNumber.Uint64() > bn {
s.SetLatestL1BlockNumber(l1BlockNumber.Uint64())
} else {
} else if l1BlockNumber.Uint64() < bn {
// l1BlockNumber < latest l1BlockNumber
// 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
......
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