mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 03:01:07 +00:00
client/network: Make NetworkService::set_priority_group async (#7352)
As done with `NetworkService::{add_to,remove_from}_priority_group`, make
`NetworkService::set_priority_group` async as well. This future-proofs
the API should we ever decide to use a bounded channel between
`NetworkService` and `NetworkWorker`.
This commit is contained in:
@@ -973,7 +973,10 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
|
||||
///
|
||||
/// Returns an `Err` if one of the given addresses is invalid or contains an
|
||||
/// invalid peer ID (which includes the local peer ID).
|
||||
pub fn set_priority_group(&self, group_id: String, peers: HashSet<Multiaddr>) -> Result<(), String> {
|
||||
//
|
||||
// NOTE: even though this function is currently sync, it's marked as async for
|
||||
// future-proofing, see https://github.com/paritytech/substrate/pull/7247#discussion_r502263451.
|
||||
pub async fn set_priority_group(&self, group_id: String, peers: HashSet<Multiaddr>) -> Result<(), String> {
|
||||
let peers = self.split_multiaddr_and_peer_id(peers)?;
|
||||
|
||||
let peer_ids = peers.iter().map(|(peer_id, _addr)| peer_id.clone()).collect();
|
||||
|
||||
Reference in New Issue
Block a user