mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 06:48:01 +00:00
Make NetworkService::add_reserved_peer() accept MultiaddrWithPeerId (#12102)
* Make `add_reserved_peer()` accept `MultiaddrWithPeerId` * minor: cargo fmt * minor: error to string conversion Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
// If you read this, you are very thorough, congratulations.
|
||||
|
||||
use crate::{
|
||||
config::MultiaddrWithPeerId,
|
||||
protocol::event::Event,
|
||||
request_responses::{IfDisconnected, RequestFailure},
|
||||
sync::{warp::WarpSyncProgress, StateDownloadProgress, SyncState},
|
||||
@@ -179,12 +180,11 @@ pub trait NetworkPeers {
|
||||
/// purposes.
|
||||
fn deny_unreserved_peers(&self);
|
||||
|
||||
/// Adds a `PeerId` and its address as reserved. The string should encode the address
|
||||
/// and peer ID of the remote node.
|
||||
/// Adds a `PeerId` and its `Multiaddr` as reserved.
|
||||
///
|
||||
/// Returns an `Err` if the given string is not a valid multiaddress
|
||||
/// or contains an invalid peer ID (which includes the local peer ID).
|
||||
fn add_reserved_peer(&self, peer: String) -> Result<(), String>;
|
||||
fn add_reserved_peer(&self, peer: MultiaddrWithPeerId) -> Result<(), String>;
|
||||
|
||||
/// Removes a `PeerId` from the list of reserved peers.
|
||||
fn remove_reserved_peer(&self, peer_id: PeerId);
|
||||
@@ -285,7 +285,7 @@ where
|
||||
T::deny_unreserved_peers(self)
|
||||
}
|
||||
|
||||
fn add_reserved_peer(&self, peer: String) -> Result<(), String> {
|
||||
fn add_reserved_peer(&self, peer: MultiaddrWithPeerId) -> Result<(), String> {
|
||||
T::add_reserved_peer(self, peer)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user