Skip to content

Conversation

@islishude
Copy link
Contributor

It's null in a pending block

if number == rpc.PendingBlockNumber {
// Pending blocks need to nil out a few fields
for _, field := range []string{"hash", "nonce", "miner"} {
response[field] = nil
}

@islishude islishude requested a review from fjl as a code owner March 27, 2025 08:39
Comment on lines +161 to +166
Copy link
Member

@lightclient lightclient May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly added this addition here. This allows us to correctly set the sender caching. It seems like a nice thing to have, since we're returning a types.Block anyways the user can compute the block hash and it's possible they later call TransactionSender with it. Felt weird to just drop that optimization on the ground for pending blocks.

Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lightclient lightclient added this to the 1.15.11 milestone May 1, 2025
@lightclient lightclient changed the title ethclient: change Hash field of rpcBlock to pointer ethclient: fix retrieval of pending block May 1, 2025
@lightclient lightclient self-assigned this May 1, 2025
@lightclient lightclient merged commit af9673b into ethereum:master May 2, 2025
3 of 4 checks passed
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
Since the block hash is not returned for pending blocks, ethclient cannot unmarshal into RPC block. This makes hash optional on rpc block and compute the hash locally for pending blocks to correctly key the tx sender cache.


https://github.com/ethereum/go-ethereum/blob/a82303f4e3cedcebe31540a53dde4f24fc93da80/internal/ethapi/api.go#L500-L504

---------

Co-authored-by: lightclient <[email protected]>
howjmay pushed a commit to iotaledger/go-ethereum that referenced this pull request Aug 27, 2025
Since the block hash is not returned for pending blocks, ethclient cannot unmarshal into RPC block. This makes hash optional on rpc block and compute the hash locally for pending blocks to correctly key the tx sender cache.


https://github.com/ethereum/go-ethereum/blob/a82303f4e3cedcebe31540a53dde4f24fc93da80/internal/ethapi/api.go#L500-L504

---------

Co-authored-by: lightclient <[email protected]>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 29, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Aug 31, 2025
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
Since the block hash is not returned for pending blocks, ethclient cannot unmarshal into RPC block. This makes hash optional on rpc block and compute the hash locally for pending blocks to correctly key the tx sender cache.


https://github.com/ethereum/go-ethereum/blob/a82303f4e3cedcebe31540a53dde4f24fc93da80/internal/ethapi/api.go#L500-L504

---------

Co-authored-by: lightclient <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants