mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
Report the network PeerId to the telemetry (#1835)
* Report the network PeerId to the telemetry * Fix accidental paste
This commit is contained in:
@@ -20,7 +20,7 @@ use std::{io, thread};
|
||||
use log::{warn, debug, error, trace};
|
||||
use futures::{Async, Future, Stream, stream, sync::oneshot};
|
||||
use parking_lot::Mutex;
|
||||
use network_libp2p::{ProtocolId, PeerId, NetworkConfiguration, NodeIndex, ErrorKind, Severity};
|
||||
use network_libp2p::{ProtocolId, NetworkConfiguration, NodeIndex, ErrorKind, Severity};
|
||||
use network_libp2p::{start_service, parse_str_addr, Service as NetworkService, ServiceEvent as NetworkServiceEvent};
|
||||
use network_libp2p::{Protocol as Libp2pProtocol, RegisteredProtocol};
|
||||
use consensus::import_queue::{ImportQueue, Link};
|
||||
@@ -36,6 +36,8 @@ use crate::specialization::NetworkSpecialization;
|
||||
use tokio::prelude::task::AtomicTask;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
pub use network_libp2p::PeerId;
|
||||
|
||||
/// Type that represents fetch completion future.
|
||||
pub type FetchFuture = oneshot::Receiver<Vec<u8>>;
|
||||
|
||||
@@ -180,6 +182,11 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>> Service<B, S> {
|
||||
self.network.lock().average_upload_per_sec()
|
||||
}
|
||||
|
||||
/// Returns the network identity of the node.
|
||||
pub fn local_peer_id(&self) -> PeerId {
|
||||
self.network.lock().peer_id().clone()
|
||||
}
|
||||
|
||||
/// Called when a new block is imported by the client.
|
||||
pub fn on_block_imported(&self, hash: B::Hash, header: B::Header) {
|
||||
let _ = self
|
||||
|
||||
Reference in New Issue
Block a user