refactor: store plain receipts instead Options in Receipts (#14010)

This commit is contained in:
Arsenii Kulikov
2025-01-27 20:05:48 +04:00
committed by GitHub
parent 0fa79c6c65
commit cde951732e
22 changed files with 88 additions and 128 deletions

View File

@ -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

View File

@ -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;