Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing strategy refactoring #5469

Merged
11 changes: 11 additions & 0 deletions prdoc/pr_5469.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Syncing strategy refactoring

doc:
- audience: Node Dev
description: |
Mostly internal changes to syncing strategies that is a step towards making them configurable/extensible in the
future. It is unlikely that external developers will need to change their code.

crates:
- name: sc-network-sync
bump: major
9 changes: 5 additions & 4 deletions substrate/client/network/sync/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{
},
strategy::{
warp::{EncodedProof, WarpProofRequest, WarpSyncConfig},
StrategyKey, SyncingAction, SyncingConfig, SyncingStrategy,
PolkadotSyncingStrategy, StrategyKey, SyncingAction, SyncingConfig, SyncingStrategy,
},
types::{
BadPeer, ExtendedPeerInfo, OpaqueStateRequest, OpaqueStateResponse, PeerRequest, SyncEvent,
Expand Down Expand Up @@ -189,7 +189,7 @@ pub struct Peer<B: BlockT> {

pub struct SyncingEngine<B: BlockT, Client> {
/// Syncing strategy.
strategy: SyncingStrategy<B, Client>,
strategy: PolkadotSyncingStrategy<B, Client>,

/// Blockchain client.
client: Arc<Client>,
Expand Down Expand Up @@ -389,7 +389,8 @@ where
);

// Initialize syncing strategy.
let strategy = SyncingStrategy::new(syncing_config, client.clone(), warp_sync_config)?;
let strategy =
PolkadotSyncingStrategy::new(syncing_config, client.clone(), warp_sync_config)?;

let block_announce_protocol_name = block_announce_config.protocol_name().clone();
let (tx, service_rx) = tracing_unbounded("mpsc_chain_sync", 100_000);
Expand Down Expand Up @@ -697,7 +698,7 @@ where
number,
)
},
// Nothing to do, this is handled internally by `SyncingStrategy`.
// Nothing to do, this is handled internally by `PolkadotSyncingStrategy`.
SyncingAction::Finished => {},
}
}
Expand Down
Loading