mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/catalyst: reset to current header if chain is rewinded
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
60ec41ce73
commit
72463097bc
1 changed files with 11 additions and 1 deletions
|
|
@ -144,6 +144,16 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal) error {
|
||||||
feeRecipient := c.feeRecipient
|
feeRecipient := c.feeRecipient
|
||||||
c.feeRecipientLock.Unlock()
|
c.feeRecipientLock.Unlock()
|
||||||
|
|
||||||
|
// Reset to CurrentBlock incase the chain is rewinded
|
||||||
|
block := c.eth.BlockChain().CurrentBlock()
|
||||||
|
if c.curForkchoiceState.HeadBlockHash != block.Hash() {
|
||||||
|
c.curForkchoiceState = engine.ForkchoiceStateV1{
|
||||||
|
HeadBlockHash: block.Hash(),
|
||||||
|
SafeBlockHash: block.Hash(),
|
||||||
|
FinalizedBlockHash: block.Hash(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fcResponse, err := c.engineAPI.ForkchoiceUpdatedV2(c.curForkchoiceState, &engine.PayloadAttributes{
|
fcResponse, err := c.engineAPI.ForkchoiceUpdatedV2(c.curForkchoiceState, &engine.PayloadAttributes{
|
||||||
Timestamp: tstamp,
|
Timestamp: tstamp,
|
||||||
SuggestedFeeRecipient: feeRecipient,
|
SuggestedFeeRecipient: feeRecipient,
|
||||||
|
|
@ -211,7 +221,7 @@ func (c *SimulatedBeacon) loopOnDemand() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loopOnDemand runs the block production loop for non-zero period configuration
|
// loop runs the block production loop for non-zero period configuration
|
||||||
func (c *SimulatedBeacon) loop() {
|
func (c *SimulatedBeacon) loop() {
|
||||||
timer := time.NewTimer(0)
|
timer := time.NewTimer(0)
|
||||||
for {
|
for {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue