mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 16:18:08 -05:00
feat(provider): implement ForkChoiceSubscriptions for BlockchainProvider2 (#10318)
This commit is contained in:
@@ -8,7 +8,10 @@ use crate::{
|
||||
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_rpc_types_engine::ForkchoiceState;
|
||||
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProvider};
|
||||
use reth_chain_state::{
|
||||
BlockState, CanonicalInMemoryState, ForkChoiceNotifications, ForkChoiceSubscriptions,
|
||||
MemoryOverlayStateProvider,
|
||||
};
|
||||
use reth_chainspec::{ChainInfo, ChainSpec};
|
||||
use reth_db_api::{
|
||||
database::Database,
|
||||
@@ -1428,6 +1431,21 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB> ForkChoiceSubscriptions for BlockchainProvider2<DB>
|
||||
where
|
||||
DB: Send + Sync,
|
||||
{
|
||||
fn subscribe_to_safe_block(&self) -> ForkChoiceNotifications {
|
||||
let receiver = self.canonical_in_memory_state.subscribe_safe_block();
|
||||
ForkChoiceNotifications(receiver)
|
||||
}
|
||||
|
||||
fn subscribe_to_finalized_block(&self) -> ForkChoiceNotifications {
|
||||
let receiver = self.canonical_in_memory_state.subscribe_finalized_block();
|
||||
ForkChoiceNotifications(receiver)
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB> ChangeSetReader for BlockchainProvider2<DB>
|
||||
where
|
||||
DB: Database,
|
||||
|
||||
Reference in New Issue
Block a user