Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_getblockbynumber should return null for pending blocks #19332

Closed
gagarin55 opened this issue Mar 26, 2019 · 3 comments
Closed

eth_getblockbynumber should return null for pending blocks #19332

gagarin55 opened this issue Mar 26, 2019 · 3 comments
Labels

Comments

@gagarin55
Copy link

Hi there,

please note that this is an issue tracker reserved for bug reports and feature requests.

For general questions please use the gitter channel or the Ethereum stack exchange at https://ethereum.stackexchange.com.

System information

Geth version: Geth/v1.8.22-omnibus-260f7fbd/linux-amd64/go1.11.1

Expected behaviour

According to documentation I expect that eth_getBlockByNumber returns number == null for pending
block

Actual behaviour

eth_getBlockByNumber('pending') returns not null in block.number field

Steps to reproduce the behaviour

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending", true],"id":1}' https://mainnet.infura.io/
@fjl fjl added the area:rpc label Jun 25, 2019
@holiman
Copy link
Contributor

holiman commented Jun 25, 2019

My thoughts:

  • Setting the block number to null does not make sense, since we do know the number of the pending block. How does parity do? cc @sorpaas
  • Setting hash, miner, mixhash to null does make sense (geth already does)
  • Currently, in the transactions returned within the pending block, the blockHash is not null:ed in geth. Which is quirky, and does not make sense to me.

@fjl
Copy link
Contributor

fjl commented Jun 25, 2019

Fixing this is trivial, just add "number" here:

for _, field := range []string{"hash", "nonce", "miner"} {

@princesinha19
Copy link
Contributor

@holiman I think we should return null for the pending block. Parity also returns null for the pending block. See this issue (openethereum/parity-ethereum#8703).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@fjl @holiman @gagarin55 @princesinha19 and others