From 5a642d3086d212b7e882d94ae56ae6d1797d8c44 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 3 Nov 2023 11:16:49 -0700 Subject: [PATCH] cache getBlockByNumber better --- web3_proxy/src/block_number.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/web3_proxy/src/block_number.rs b/web3_proxy/src/block_number.rs index 95bd71be..6d6a8343 100644 --- a/web3_proxy/src/block_number.rs +++ b/web3_proxy/src/block_number.rs @@ -255,6 +255,7 @@ fn get_block_param_id(method: &str) -> Option { "eth_estimateGas" => Some(1), "eth_feeHistory" => Some(1), "eth_getBalance" => Some(1), + "eth_getBlockByNumber" => Some(0), "eth_getBlockReceipts" => Some(0), "eth_getBlockTransactionCountByNumber" => Some(0), "eth_getCode" => Some(1), @@ -354,16 +355,6 @@ impl CacheMode { // TODO: make sure re-orgs work properly! Ok(Self::SuccessForever) } - "eth_getBlockByNumber" => { - // TODO: double check that any node can serve this - // TODO: CacheSuccessForever if the block is old enough - // TODO: make sure re-orgs work properly! - Ok(Self::Standard { - block_needed: head_block.into(), - cache_block: head_block.into(), - cache_errors: true, - }) - } "eth_getBlockTransactionCountByHash" => { // TODO: double check that any node can serve this Ok(Self::SuccessForever)