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_getBalance returns error message for queries at block 0 #1103

Closed
tjayrush opened this issue Sep 11, 2020 · 2 comments · Fixed by #1106
Closed

eth_getBalance returns error message for queries at block 0 #1103

tjayrush opened this issue Sep 11, 2020 · 2 comments · Fixed by #1106

Comments

@tjayrush
Copy link
Contributor

tjayrush commented Sep 11, 2020

This curl command:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xa1e4380a3b1f749673e270229993ee55f35663b4", "0x0"],"id":64}' -H "Content-Type: application/json" <RPC URL>

returns this:

{"jsonrpc":"2.0","result":"0x6c6b935b8bbd400000","id":64}

Against both Parity and Geth.

Against TurboGeth it returns:

{"jsonrpc":"2.0","id":64,"error":{"code":-32000,"message":"pending and earliest blocks are not supported"}}

If I change this line from this:

		} else if number == rpc.PendingBlockNumber || number == rpc.EarliestBlockNumber {
			return 0, common.Hash{}, fmt.Errorf("pending and earliest blocks are not supported")

to

		} else if number == rpc.EarliestBlockNumber {
			blockNumber = 0

		} else if number == rpc.PendingBlockNumber {
			return 0, common.Hash{}, fmt.Errorf("pending and earliest blocks are not supported")

It works, but I don't know if that's the right thing to do, so I didn't make a PR. I'm curious why this line returns an error.

@AlexeyAkhunov
Copy link
Contributor

Yes, it is ok to fix it as you suggest. I was not sure what to do with that EarliestBlock thing, so I just bundled it up with "not supported". When we implement snapshotting, we will need to write it in here

@tjayrush
Copy link
Contributor Author

I'll do this now.

tjayrush added a commit that referenced this issue Sep 11, 2020
AlexeyAkhunov pushed a commit that referenced this issue Sep 12, 2020
cffls pushed a commit to cffls/erigon that referenced this issue Sep 4, 2024
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 a pull request may close this issue.

2 participants