mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 16:01:36 +00:00
getPending builds the pending block on demand via generateWork, but after EIP-7843 (#33589) prepareWork rejects the call unless generateParams.slotNum is non-nil once Amsterdam is active: if miner.chainConfig.IsAmsterdam(header.Number, header.Time) { if genParams.slotNum == nil { return nil, errors.New("no slot number set post-amsterdam") } header.SlotNumber = genParams.slotNum } getPending never populated slotNum, so on any Amsterdam-activated chain eth_getBalance(addr, "pending") (and every other RPC that resolves through the pending state) fails with "pending state is not available", breaking faucets and nonce trackers that poll pending. Fix by synthesising a slot number from the parent header when available, mirroring how the Shanghai branch above already conditionally populates withdrawals. The pending block is empty post-merge so the exact slot value is not user-visible; SlotNumber+1 (or zero) is sufficient to satisfy the prepareWork invariant. Observed on a bal-devnet-3 Geth build: every eth_getBalance(...,"pending") returned -32000 "pending state is not available" until the faucet was repointed at a non-Geth EL. Other clients (Nethermind, Besu, Reth, Erigon, Ethrex) serve pending on the same chain without issue. |
||
|---|---|---|
| .. | ||
| stress | ||
| miner.go | ||
| miner_test.go | ||
| ordering.go | ||
| ordering_test.go | ||
| payload_building.go | ||
| payload_building_test.go | ||
| pending.go | ||
| worker.go | ||