Skip to content

Commit 3fb6499

Browse files
eth/catalyst: fix edge case in simulated backend (#31871)
geth cmd: `geth --dev --dev.period 5` call: `debug.setHead` to rollback several blocks. If the `debug.setHead` call is delayed, it will trigger a panic with a small probability, due to using the null point of `fcResponse.PayloadID`. --------- Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
1 parent 62a17fd commit 3fb6499

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

eth/catalyst/simulated_beacon.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
208208
return errors.New("chain rewind prevented invocation of payload creation")
209209
}
210210

211+
// If the payload was already known, we can skip the rest of the process.
212+
// This edge case is possible due to a race condition between seal and debug.setHead.
213+
if fcResponse.PayloadStatus.Status == engine.VALID && fcResponse.PayloadID == nil {
214+
return nil
215+
}
216+
211217
envelope, err := c.engineAPI.getPayload(*fcResponse.PayloadID, true)
212218
if err != nil {
213219
return err

0 commit comments

Comments
 (0)