mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
core/network: Surface peerset's set_priority_group in NetworkService (#3376)
`PeerSetHandle.set_priority_group` allows modifying a priority group by group identifier. With this commit the function can be accessed through `NetworkService`. This is need in order for a validator to connect to as many other validators as configured without reserving a specific connection slot for them.
This commit is contained in:
@@ -163,7 +163,8 @@ impl ProtocolId {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a string address and returns the component, if valid.
|
||||
/// Parses a string address and splits it into Multiaddress and PeerId, if
|
||||
/// valid.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -177,8 +178,12 @@ impl ProtocolId {
|
||||
/// ```
|
||||
///
|
||||
pub fn parse_str_addr(addr_str: &str) -> Result<(PeerId, Multiaddr), ParseErr> {
|
||||
let mut addr: Multiaddr = addr_str.parse()?;
|
||||
let addr: Multiaddr = addr_str.parse()?;
|
||||
parse_addr(addr)
|
||||
}
|
||||
|
||||
/// Splits a Multiaddress into a Multiaddress and PeerId.
|
||||
pub fn parse_addr(mut addr: Multiaddr)-> Result<(PeerId, Multiaddr), ParseErr> {
|
||||
let who = match addr.pop() {
|
||||
Some(multiaddr::Protocol::P2p(key)) => PeerId::from_multihash(key)
|
||||
.map_err(|_| ParseErr::InvalidPeerId)?,
|
||||
|
||||
Reference in New Issue
Block a user