Skip to content

How does viem handle incorrect block height from infura? #354

Answered by jxom
benesjan asked this question in Question
Discussion options

You must be logged in to vote

viem uses eth_newFilter & eth_getFilterChanges for watchContractEvent, which is mutually exclusive of latest block number. So it should work for Infura (to answer your question).

However, if the RPC Provider does not support filters, we fall back to eth_getLogs which is mutually inclusive of latest block number. We rely on the previously queried block number there, so it’ll probably be a good idea to update the fall back implementation for the case you mentioned (for RPC providers that don’t support filters and have load balancing mechanisms).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jxom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants