mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Get rid of Peerset compatibility layer (#14337)
* Move bootnodes from individual `SetConfig`s to `PeersetConfig` * Move `SetId` & `SetConfig` from `peerset` to `protocol_controller` * Remove unused `DropReason` * Move `Message` & `IncomingIndex` from `peerset` to `protocol_controller` * Restore running fuzz test * Get rid of `Peerset` in `fuzz` test * Spawn runners instead of manual polling in `fuzz` test * Migrate `Protocol` from `Peerset` to `PeerStore` & `ProtocolController` * Migrate `NetworkService` from `Peerset` to `PeerStore` & `ProtocolController` * Migrate `Notifications` from `Peerset` to `ProtocolController`s * Migrate `Notifications` tests from `Peerset` to `ProtocolController` * Fix compilation of `NetworkService` & `Protocol` * Fix borrowing issues in `Notifications` * Migrate `RequestResponse`from `Peerset` to `PeerStore` * rustfmt * Migrate request-response tests from `Peerset` to `PeerStore` * Migrate `reconnect_after_disconnect` test to `PeerStore` & `ProtocolController` * Fix `Notifications` tests * Remove `Peerset` completely * Fix bug with counting sync peers in `Protocol` * Eliminate indirect calls to `PeerStore` via `Protocol` * Eliminate indirect calls to `ProtocolController` via `Protocol` * Handle `Err` outcome from `remove_peers_from_reserved_set` * Add note about disconnecting sync peers in `Protocol` * minor: remove unneeded `clone()` * minor: extra comma removed * minor: use `Stream` API of `from_protocol_controllers` channel * minor: remove TODO * minor: replace `.map().flatten()` with `.flat_map()` * minor: update `ProtocolController` docs * rustfmt * Apply suggestions from code review Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com> * Extract `MockPeerStore` to `mock.rs` * Move `PeerStore` initialization to `build_network` * minor: remove unused import * minor: clarify error message * Convert `syncs_header_only_forks` test into single-threaded --------- Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
This commit is contained in:
@@ -43,6 +43,7 @@ use sc_executor::{
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_network::{
|
||||
config::{FullNetworkConfiguration, SyncMode},
|
||||
peer_store::PeerStore,
|
||||
NetworkService, NetworkStateInfo, NetworkStatusProvider,
|
||||
};
|
||||
use sc_network_bitswap::BitswapRequestHandler;
|
||||
@@ -860,6 +861,18 @@ where
|
||||
);
|
||||
net_config.add_notification_protocol(transactions_handler_proto.set_config());
|
||||
|
||||
// Create `PeerStore` and initialize it with bootnode peer ids.
|
||||
let peer_store = PeerStore::new(
|
||||
net_config
|
||||
.network_config
|
||||
.boot_nodes
|
||||
.iter()
|
||||
.map(|bootnode| bootnode.peer_id)
|
||||
.collect(),
|
||||
);
|
||||
let peer_store_handle = peer_store.handle();
|
||||
spawn_handle.spawn("peer-store", Some("networking"), peer_store.run());
|
||||
|
||||
let (tx, rx) = sc_utils::mpsc::tracing_unbounded("mpsc_syncing_engine_protocol", 100_000);
|
||||
let (chain_sync_network_provider, chain_sync_network_handle) = NetworkServiceProvider::new();
|
||||
let (engine, sync_service, block_announce_config) = SyncingEngine::new(
|
||||
@@ -891,6 +904,7 @@ where
|
||||
})
|
||||
},
|
||||
network_config: net_config,
|
||||
peer_store: peer_store_handle,
|
||||
genesis_hash,
|
||||
protocol_id: protocol_id.clone(),
|
||||
fork_id: config.chain_spec.fork_id().map(ToOwned::to_owned),
|
||||
|
||||
Reference in New Issue
Block a user