mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: store plain receipts instead Options in Receipts (#14010)
This commit is contained in:
10
crates/rpc/rpc-eth-types/src/cache/mod.rs
vendored
10
crates/rpc/rpc-eth-types/src/cache/mod.rs
vendored
@ -516,9 +516,7 @@ where
|
||||
for block_receipts in chain_change.receipts {
|
||||
this.on_new_receipts(
|
||||
block_receipts.block_hash,
|
||||
Ok(Some(Arc::new(
|
||||
block_receipts.receipts.into_iter().flatten().collect(),
|
||||
))),
|
||||
Ok(Some(Arc::new(block_receipts.receipts))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -530,9 +528,7 @@ where
|
||||
for block_receipts in chain_change.receipts {
|
||||
this.on_reorg_receipts(
|
||||
block_receipts.block_hash,
|
||||
Ok(Some(Arc::new(
|
||||
block_receipts.receipts.into_iter().flatten().collect(),
|
||||
))),
|
||||
Ok(Some(Arc::new(block_receipts.receipts))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -558,7 +554,7 @@ enum CacheAction<B: Block, R> {
|
||||
|
||||
struct BlockReceipts<R> {
|
||||
block_hash: B256,
|
||||
receipts: Vec<Option<R>>,
|
||||
receipts: Vec<R>,
|
||||
}
|
||||
|
||||
/// A change of the canonical chain
|
||||
|
||||
@ -250,7 +250,7 @@ pub async fn fee_history_cache_new_blocks_task<St, Provider, N>(
|
||||
let (blocks, receipts): (Vec<_>, Vec<_>) = committed
|
||||
.blocks_and_receipts()
|
||||
.map(|(block, receipts)| {
|
||||
(block.clone_sealed_block(), Arc::new(receipts.iter().flatten().cloned().collect::<Vec<_>>()))
|
||||
(block.clone_sealed_block(), Arc::new(receipts.clone()))
|
||||
})
|
||||
.unzip();
|
||||
fee_history_cache.insert_blocks(blocks.iter().zip(receipts)).await;
|
||||
|
||||
Reference in New Issue
Block a user