diff --git a/crates/storage/provider/src/post_state.rs b/crates/storage/provider/src/post_state.rs index 30a00d4bbf..3bd9dadb19 100644 --- a/crates/storage/provider/src/post_state.rs +++ b/crates/storage/provider/src/post_state.rs @@ -7,7 +7,8 @@ use reth_db::{ Error as DbError, }; use reth_primitives::{ - Account, Address, Bytecode, Receipt, StorageEntry, TransitionId, H256, U256, + bloom::logs_bloom, Account, Address, Bloom, Bytecode, Log, Receipt, StorageEntry, TransitionId, + H256, U256, }; use std::collections::BTreeMap; @@ -262,6 +263,16 @@ impl PostState { &self.receipts } + /// Returns an iterator over all logs in this [PostState]. + pub fn logs(&self) -> impl Iterator + '_ { + self.receipts().iter().flat_map(|r| r.logs.iter()) + } + + /// Returns the logs bloom for all recorded logs. + pub fn logs_bloom(&self) -> Bloom { + logs_bloom(self.logs()) + } + /// Get the number of transitions causing this [PostState] pub fn transitions_count(&self) -> TransitionId { self.current_transition_id