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

Fix getBlockTransactionCount returning null #6793

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

fafrd
Copy link
Contributor

@fafrd fafrd commented Feb 7, 2023

So... for blocks that don't exist, the eth_getBlockTransactionCount RPCs should return null. Erigon does this correctly right now and this is covered by the unit test in rpcdaemon/commands/corner_cases_support_test.go.

But, for blocks that don't have any transactions, like 703696, the RPC also returns null.

I've changed this to correctly return 0 and have added 2 new tests to handle it. (I had to add another block to the test chain in rpcdaemon/rpcdaemontest/test_util.go and had to fix a few other tests that broke as a result.)

Resolves #6775

@fafrd fafrd changed the title Change getBlockTransactionCount to not return null Fix getBlockTransactionCount returning null Feb 7, 2023
@AskAlexSharov AskAlexSharov merged commit 72c01b2 into erigontech:devel Feb 7, 2023
finiteops pushed a commit to bitfinity-network/erigon that referenced this pull request Apr 10, 2023
So... for blocks that don't exist, the eth_getBlockTransactionCount RPCs
should return `null`. Erigon does this correctly right now and this is
covered by the unit test in
[rpcdaemon/commands/corner_cases_support_test.go](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/corner_cases_support_test.go).

But, for blocks that don't have any transactions, like
[703696](https://etherscan.io/block/703696), the RPC also returns
`null`.

I've changed this to correctly return `0` and have added 2 new tests to
handle it. (I had to add another block to the test chain in
rpcdaemon/rpcdaemontest/test_util.go and had to fix a few other tests
that broke as a result.)

Resolves erigontech#6775
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.

eth_getBlockTransactionCountByNumber returns null when 0 TXs in block
2 participants