eth/catalyst: use IsAmsterdam when sealing simulated beacon blocks (#35392)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This commit is contained in:
cui 2026-08-06 16:20:18 +08:00 committed by GitHub
parent c6c7ffbbaf
commit b14428613b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"math" "math"
"math/big"
"sync" "sync"
"time" "time"
@ -178,9 +179,10 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
c.feeRecipientLock.Lock() c.feeRecipientLock.Lock()
feeRecipient := c.feeRecipient feeRecipient := c.feeRecipient
c.feeRecipientLock.Unlock() c.feeRecipientLock.Unlock()
header := c.eth.BlockChain().CurrentBlock()
// Reset to CurrentBlock in case of the chain was rewound // Reset to CurrentBlock in case of the chain was rewound
if header := c.eth.BlockChain().CurrentBlock(); c.curForkchoiceState.HeadBlockHash != header.Hash() { if c.curForkchoiceState.HeadBlockHash != header.Hash() {
finalizedHash := c.finalizedBlockHash(header.Number.Uint64()) finalizedHash := c.finalizedBlockHash(header.Number.Uint64())
c.setCurrentState(header.Hash(), *finalizedHash) c.setCurrentState(header.Hash(), *finalizedHash)
} }
@ -208,7 +210,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
Random: random, Random: random,
BeaconRoot: &common.Hash{}, BeaconRoot: &common.Hash{},
} }
if c.eth.BlockChain().Config().LatestFork(timestamp) == forks.Amsterdam { if c.eth.BlockChain().Config().IsAmsterdam(new(big.Int).Add(header.Number, big.NewInt(1)), timestamp) {
slotNumber := uint64(0) slotNumber := uint64(0)
attribute.SlotNumber = &slotNumber attribute.SlotNumber = &slotNumber
} }