cache getBlockByNumber better

This commit is contained in:
Bryan Stitt 2023-11-03 11:16:49 -07:00
parent 4ce9f8557a
commit 5a642d3086

View File

@ -255,6 +255,7 @@ fn get_block_param_id(method: &str) -> Option<usize> {
"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)