miner: set slot number for pending block post-Amsterdam (#34792)
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:
Barnabas Busa 2026-05-28 10:52:27 +02:00 committed by GitHub
parent 4017efe345
commit 95320ffe69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,12 +151,24 @@ func (miner *Miner) getPending() *newPayloadResult {
return cached
}
var (
timestamp = uint64(time.Now().Unix())
withdrawal types.Withdrawals
timestamp = uint64(time.Now().Unix())
childNumber = new(big.Int).Add(header.Number, big.NewInt(1))
withdrawal types.Withdrawals
slotNum *uint64
)
if miner.chainConfig.IsShanghai(new(big.Int).Add(header.Number, big.NewInt(1)), timestamp) {
if miner.chainConfig.IsShanghai(childNumber, timestamp) {
withdrawal = []*types.Withdrawal{}
}
// Post-Amsterdam, prepareWork requires a slot number (EIP-7843). The pending
// block is synthetic and has no canonical slot, so derive one from the parent
// when available and fall back to zero otherwise.
if miner.chainConfig.IsAmsterdam(childNumber, timestamp) {
var n uint64
if header.SlotNumber != nil {
n = *header.SlotNumber + 1
}
slotNum = &n
}
ret := miner.generateWork(context.Background(),
&generateParams{
timestamp: timestamp,
@ -166,6 +178,7 @@ func (miner *Miner) getPending() *newPayloadResult {
random: common.Hash{},
withdrawals: withdrawal,
beaconRoot: nil,
slotNum: slotNum,
noTxs: false,
}, false) // we will never make a witness for a pending block
if ret.err != nil {