mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
The NodeId is always available in the session info (#859)
This commit is contained in:
@@ -34,7 +34,6 @@ extern crate rand;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate bytes;
|
||||
extern crate unsigned_varint;
|
||||
|
||||
@@ -45,11 +44,9 @@ extern crate log;
|
||||
#[cfg(test)] #[macro_use]
|
||||
extern crate assert_matches;
|
||||
|
||||
use libp2p::PeerId;
|
||||
|
||||
pub use connection_filter::{ConnectionFilter, ConnectionDirection};
|
||||
pub use error::{Error, ErrorKind, DisconnectReason};
|
||||
pub use libp2p::{Multiaddr, multiaddr::Protocol};
|
||||
pub use libp2p::{Multiaddr, multiaddr::Protocol, PeerId};
|
||||
pub use traits::*;
|
||||
|
||||
pub type TimerToken = usize;
|
||||
|
||||
@@ -552,7 +552,7 @@ impl NetworkContext for NetworkContextImpl {
|
||||
};
|
||||
|
||||
Some(SessionInfo {
|
||||
id: None, // TODO: ???? what to do??? wrong format!
|
||||
id: info.id.clone(),
|
||||
client_version: info.client_version.clone().take().unwrap_or(String::new()),
|
||||
protocol_version: From::from(protocol_version),
|
||||
capabilities: Vec::new(), // TODO: list of supported protocols ; hard
|
||||
|
||||
@@ -21,9 +21,8 @@ use std::net::Ipv4Addr;
|
||||
use std::str;
|
||||
use std::time::Duration;
|
||||
use TimerToken;
|
||||
use libp2p::{multiaddr::Protocol, Multiaddr};
|
||||
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId};
|
||||
use error::Error;
|
||||
use primitives::hash::H512;
|
||||
|
||||
/// Protocol handler level packet id
|
||||
pub type PacketId = u8;
|
||||
@@ -31,7 +30,7 @@ pub type PacketId = u8;
|
||||
pub type ProtocolId = [u8; 3];
|
||||
|
||||
/// Node public key
|
||||
pub type NodeId = H512;
|
||||
pub type NodeId = PeerId;
|
||||
|
||||
/// Local (temporary) peer session ID.
|
||||
pub type NodeIndex = usize;
|
||||
@@ -43,7 +42,7 @@ pub type Secret = [u8; 32];
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SessionInfo {
|
||||
/// Peer public key
|
||||
pub id: Option<NodeId>,
|
||||
pub id: NodeId,
|
||||
/// Peer client ID
|
||||
pub client_version: String,
|
||||
/// Peer RLPx protocol version
|
||||
|
||||
Reference in New Issue
Block a user