chore: add PostState::logs_bloom (#2191)

This commit is contained in:
Matthias Seitz
2023-04-11 17:52:46 +02:00
committed by GitHub
parent 9c1a33e527
commit ddc1407243

View File

@@ -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<Item = &Log> + '_ {
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