mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: CanonStateNotification for commit and reorg (#2156)
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
use crate::dirs::{JwtSecretPath, PlatformPath};
|
||||
use clap::Args;
|
||||
use jsonrpsee::server::ServerHandle;
|
||||
use reth_interfaces::events::ChainEventSubscriptions;
|
||||
use reth_network_api::{NetworkInfo, Peers};
|
||||
use reth_primitives::ChainSpec;
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_provider::{
|
||||
BlockProvider, CanonStateSubscriptions, EvmEnvProvider, HeaderProvider, StateProviderFactory,
|
||||
};
|
||||
use reth_rpc::{JwtError, JwtSecret};
|
||||
use reth_rpc_builder::{
|
||||
constants, error::RpcError, IpcServerBuilder, RethRpcModule, RpcModuleSelection,
|
||||
@@ -134,7 +135,7 @@ impl RpcServerArgs {
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
Tasks: TaskSpawner + Clone + 'static,
|
||||
Events: ChainEventSubscriptions + Clone + 'static,
|
||||
Events: CanonStateSubscriptions + Clone + 'static,
|
||||
{
|
||||
reth_rpc_builder::launch(
|
||||
client,
|
||||
|
||||
@@ -30,7 +30,6 @@ use reth_executor::blockchain_tree::{
|
||||
};
|
||||
use reth_interfaces::{
|
||||
consensus::{Consensus, ForkchoiceState},
|
||||
events::NewBlockNotificationSink,
|
||||
p2p::{
|
||||
bodies::{client::BodiesClient, downloader::BodyDownloader},
|
||||
headers::{client::StatusUpdater, downloader::HeaderDownloader},
|
||||
@@ -231,11 +230,11 @@ impl Command {
|
||||
let tree_config = BlockchainTreeConfig::default();
|
||||
// The size of the broadcast is twice the maximum reorg depth, because at maximum reorg
|
||||
// depth at least N blocks must be sent at once.
|
||||
let new_block_notification_sender =
|
||||
NewBlockNotificationSink::new(tree_config.max_reorg_depth() as usize * 2);
|
||||
let (canon_state_notification_sender, _receiver) =
|
||||
tokio::sync::broadcast::channel(tree_config.max_reorg_depth() as usize * 2);
|
||||
let blockchain_tree = ShareableBlockchainTree::new(BlockchainTree::new(
|
||||
tree_externals,
|
||||
new_block_notification_sender.clone(),
|
||||
canon_state_notification_sender.clone(),
|
||||
tree_config,
|
||||
)?);
|
||||
|
||||
@@ -246,7 +245,7 @@ impl Command {
|
||||
shareable_db.clone(),
|
||||
transaction_pool.clone(),
|
||||
consensus_engine_tx.clone(),
|
||||
new_block_notification_sender.clone(),
|
||||
canon_state_notification_sender,
|
||||
)
|
||||
.build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user