feat(flashblocks): support eth_getBlockTransactionCount for flashblocks (#20291)

Co-authored-by: lucas <66681646+limyeechern@users.noreply.github.com>
Co-authored-by: lucas.lim <lucas.lim@okg.com>
This commit is contained in:
Niven
2025-12-15 19:29:23 +08:00
committed by GitHub
parent f927eec880
commit bb952be5b5

View File

@@ -74,7 +74,11 @@ pub trait EthBlocks: LoadBlock<RpcConvert: RpcConvert<Primitives = Self::Primiti
block_id: BlockId,
) -> impl Future<Output = Result<Option<usize>, Self::Error>> + Send {
async move {
// If no pending block from provider, build the pending block locally.
if block_id.is_pending() {
if let Some(pending) = self.local_pending_block().await? {
return Ok(Some(pending.block.body().transaction_count()));
}
// Pending block can be fetched directly without need for caching
return Ok(self
.provider()