Commit 411a14e
committed
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).1 parent 3fba7f9 commit 411a14e
1 file changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
585 | 597 | | |
586 | 598 | | |
587 | 599 | | |
| |||
1076 | 1088 | | |
1077 | 1089 | | |
1078 | 1090 | | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
1079 | 1103 | | |
1080 | 1104 | | |
1081 | 1105 | | |
| |||
0 commit comments