mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
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>
This commit is contained in:
parent
62a17fdb25
commit
3fb6499fc9
1 changed files with 6 additions and 0 deletions
|
|
@ -208,6 +208,12 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
|
|||
return errors.New("chain rewind prevented invocation of payload creation")
|
||||
}
|
||||
|
||||
// If the payload was already known, we can skip the rest of the process.
|
||||
// This edge case is possible due to a race condition between seal and debug.setHead.
|
||||
if fcResponse.PayloadStatus.Status == engine.VALID && fcResponse.PayloadID == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
envelope, err := c.engineAPI.getPayload(*fcResponse.PayloadID, true)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue