Skip to content

getLogs should raise pruned history error for block number 0 #31939

Closed
@s1na

Description

@s1na

When querying logs in a pruned node:

> eth.getLogs({ fromBlock: '0x0', toBlock: 'latest' })
Error: failed to get logs for block #0 (0xd4e567..cb8fa3)
        at web3.js:6386:9(39)
        at send (web3.js:5115:62(29))
        at <eval>:1:12(7)

> eth.getLogs({ fromBlock: '0x1', toBlock: 'latest' })
Error: pruned history unavailable
        at web3.js:6386:9(39)
        at send (web3.js:5115:62(29))
        at <eval>:1:12(7)

It means getLogs somehow sees block 0 as special and doesn't do the pruned history check properly on it. I guess it was because 0 was the special block number for the "earliest" tag.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions