feat: light cleaning (#10385)

This commit is contained in:
greged93
2024-08-19 21:26:29 -07:00
committed by GitHub
parent 9dc855d7e1
commit 7f6aa433c9
2 changed files with 6 additions and 7 deletions

View File

@ -169,12 +169,11 @@ impl CanonicalInMemoryState {
) -> Self {
let in_memory_state = InMemoryState::new(blocks, numbers, pending);
let head_state = in_memory_state.head_state();
let header = match head_state {
Some(state) => state.block().block().header.clone(),
None => SealedHeader::default(),
};
let header =
head_state.map(|state| state.block().block().header.clone()).unwrap_or_default();
let chain_info_tracker = ChainInfoTracker::new(header, finalized);
let (canon_state_notification_sender, _canon_state_notification_receiver) =
let (canon_state_notification_sender, _) =
broadcast::channel(CANON_STATE_NOTIFICATION_CHANNEL_SIZE);
let inner = CanonicalInMemoryStateInner {
@ -196,7 +195,7 @@ impl CanonicalInMemoryState {
pub fn with_head(head: SealedHeader, finalized: Option<SealedHeader>) -> Self {
let chain_info_tracker = ChainInfoTracker::new(head, finalized);
let in_memory_state = InMemoryState::default();
let (canon_state_notification_sender, _canon_state_notification_receiver) =
let (canon_state_notification_sender, _) =
broadcast::channel(CANON_STATE_NOTIFICATION_CHANNEL_SIZE);
let inner = CanonicalInMemoryStateInner {
chain_info_tracker,

View File

@ -37,7 +37,7 @@ use tracing::trace;
/// This type serves as the main entry point for interacting with the blockchain and provides data
/// from database storage and from the blockchain tree (pending state etc.) It is a simple wrapper
/// type that holds an instance of the database and the blockchain tree.
#[allow(missing_debug_implementations)]
#[derive(Debug)]
pub struct BlockchainProvider2<DB> {
/// Provider type used to access the database.
database: ProviderFactory<DB>,