File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,12 +151,24 @@ func (miner *Miner) getPending() *newPayloadResult {
151151 return cached
152152 }
153153 var (
154- timestamp = uint64 (time .Now ().Unix ())
155- withdrawal types.Withdrawals
154+ timestamp = uint64 (time .Now ().Unix ())
155+ childNumber = new (big.Int ).Add (header .Number , big .NewInt (1 ))
156+ withdrawal types.Withdrawals
157+ slotNum * uint64
156158 )
157- if miner .chainConfig .IsShanghai (new (big. Int ). Add ( header . Number , big . NewInt ( 1 )) , timestamp ) {
159+ if miner .chainConfig .IsShanghai (childNumber , timestamp ) {
158160 withdrawal = []* types.Withdrawal {}
159161 }
162+ // Post-Amsterdam, prepareWork requires a slot number (EIP-7843). The pending
163+ // block is synthetic and has no canonical slot, so derive one from the parent
164+ // when available and fall back to zero otherwise.
165+ if miner .chainConfig .IsAmsterdam (childNumber , timestamp ) {
166+ var n uint64
167+ if header .SlotNumber != nil {
168+ n = * header .SlotNumber + 1
169+ }
170+ slotNum = & n
171+ }
160172 ret := miner .generateWork (context .Background (),
161173 & generateParams {
162174 timestamp : timestamp ,
@@ -166,6 +178,7 @@ func (miner *Miner) getPending() *newPayloadResult {
166178 random : common.Hash {},
167179 withdrawals : withdrawal ,
168180 beaconRoot : nil ,
181+ slotNum : slotNum ,
169182 noTxs : false ,
170183 }, false ) // we will never make a witness for a pending block
171184 if ret .err != nil {
You can’t perform that action at this time.
0 commit comments