mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Introduce ChainSyncInterface (#12489)
* Introduce `ChainSyncInterface` `ChainSyncInterface` provides an asynchronous interface for other subsystems to submit calls to `ChainSync`. This allows `NetworkService` to delegate calls to `ChainSync` while still providing the same API for other subsystems (for now). This makes it possible to move the syncing code in piecemeal fashion out of `protocol.rs` as the calls are just forwarded to `ChainSync`. * Apply review comments * Fix tests
This commit is contained in:
@@ -279,6 +279,7 @@ pub use service::{
|
||||
DecodingError, Keypair, NetworkService, NetworkWorker, NotificationSender,
|
||||
NotificationSenderReady, OutboundFailure, PublicKey,
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, NumberFor};
|
||||
|
||||
pub use sc_peerset::ReputationChange;
|
||||
|
||||
@@ -293,3 +294,14 @@ const MAX_CONNECTIONS_PER_PEER: usize = 2;
|
||||
|
||||
/// The maximum number of concurrent established connections that were incoming.
|
||||
const MAX_CONNECTIONS_ESTABLISHED_INCOMING: u32 = 10_000;
|
||||
|
||||
/// Abstraction over syncing-related services
|
||||
pub trait ChainSyncInterface<B: BlockT>:
|
||||
NetworkSyncForkRequest<B::Hash, NumberFor<B>> + Send + Sync
|
||||
{
|
||||
}
|
||||
|
||||
impl<T, B: BlockT> ChainSyncInterface<B> for T where
|
||||
T: NetworkSyncForkRequest<B::Hash, NumberFor<B>> + Send + Sync
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user