From 7be7f59d5caf38ca0cd7a12a937a2cfdca0268d7 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 23 May 2024 00:21:59 +0200 Subject: p2p: add rpc server to monitor example --- p2p/src/backend.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'p2p/src') diff --git a/p2p/src/backend.rs b/p2p/src/backend.rs index 0db1cee..98297e5 100644 --- a/p2p/src/backend.rs +++ b/p2p/src/backend.rs @@ -25,6 +25,9 @@ pub struct Backend { /// Identity Key pair key_pair: KeyPair, + /// Peer ID + peer_id: PeerID, + /// Responsible for network and system monitoring. monitor: Arc, @@ -65,6 +68,7 @@ impl Backend { Arc::new(Self { key_pair: key_pair.clone(), + peer_id, monitor, discovery, config, @@ -97,8 +101,13 @@ impl Backend { self.config.clone() } + /// Returns the `PeerID`. + pub fn peer_id(&self) -> &PeerID { + &self.peer_id + } + /// Returns the `KeyPair`. - pub async fn key_pair(&self) -> &KeyPair { + pub fn key_pair(&self) -> &KeyPair { &self.key_pair } -- cgit v1.2.3