mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(net): move reth_network::BlockDownloaderProvider to reth-network-api (#10003)
This commit is contained in:
@ -17,6 +17,7 @@ reth-eth-wire.workspace = true
|
||||
alloy-rpc-types-admin.workspace = true
|
||||
reth-network-peers.workspace = true
|
||||
reth-network-types.workspace = true
|
||||
reth-network-p2p.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-primitives.workspace = true
|
||||
@ -24,6 +25,9 @@ alloy-primitives.workspace = true
|
||||
# eth
|
||||
enr = { workspace = true, default-features = false, features = ["rust-secp256k1"] }
|
||||
|
||||
# async
|
||||
futures.workspace = true
|
||||
|
||||
# misc
|
||||
thiserror.workspace = true
|
||||
serde = { workspace = true, features = ["derive"], optional = true }
|
||||
|
||||
16
crates/net/network-api/src/downloaders.rs
Normal file
16
crates/net/network-api/src/downloaders.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//! API related to syncing blocks.
|
||||
|
||||
use futures::Future;
|
||||
use reth_network_p2p::BlockClient;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
/// Provides client for downloading blocks.
|
||||
#[auto_impl::auto_impl(&, Arc)]
|
||||
pub trait BlockDownloaderProvider {
|
||||
/// Returns a new [`BlockClient`], used for fetching blocks from peers.
|
||||
///
|
||||
/// The client is the entrypoint for sending block requests to the network.
|
||||
fn fetch_client(
|
||||
&self,
|
||||
) -> impl Future<Output = Result<impl BlockClient + 'static, oneshot::error::RecvError>> + Send;
|
||||
}
|
||||
@ -13,15 +13,19 @@
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
pub mod downloaders;
|
||||
/// Network Error
|
||||
pub mod error;
|
||||
/// Implementation of network traits for that does nothing.
|
||||
pub mod noop;
|
||||
|
||||
pub use alloy_rpc_types_admin::EthProtocolInfo;
|
||||
pub use error::NetworkError;
|
||||
pub use reth_network_p2p::BlockClient;
|
||||
pub use reth_network_types::{PeerKind, PeersHandle, Reputation, ReputationChangeKind};
|
||||
|
||||
pub use downloaders::BlockDownloaderProvider;
|
||||
pub use error::NetworkError;
|
||||
|
||||
use std::{future::Future, net::SocketAddr, sync::Arc, time::Instant};
|
||||
|
||||
use reth_eth_wire::{capability::Capabilities, DisconnectReason, EthVersion, Status};
|
||||
|
||||
Reference in New Issue
Block a user