SIGN IN SIGN UP

chain/ethereum: Check block cache before RPC in is_on_main_chain and block_pointer_from_number

Both methods previously always made an eth_getBlockByNumber RPC call.
is_on_main_chain is called every reconciliation cycle for subgraphs that
are beyond the reorg threshold, so with many syncing subgraphs this
generated a flood of unnecessary calls for blocks already in the cache.

Both methods now check chain_store.block_ptrs_by_numbers first and only
fall back to RPC when the cache has no entry or an ambiguous result
(multiple blocks at the same number due to a recorded reorg).
D
David Lutterkort committed
411a14e4b5059ae5da38f0f44b794582cefa498b
Parent: 3fba7f9