Add alternative RPC methods to system_networkState (#5643)

* Add alternatives to system_networkState

* Fix tests

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
Pierre Krieger
2020-04-16 17:36:14 +02:00
committed by GitHub
parent 6bd93825ca
commit 95ee37d242
5 changed files with 79 additions and 0 deletions
@@ -59,6 +59,17 @@ pub trait SystemApi<Hash, Number> {
#[rpc(name = "system_health", returns = "Health")]
fn system_health(&self) -> Receiver<Health>;
/// Returns the base58-encoded PeerId of the node.
#[rpc(name = "system_localPeerId", returns = "String")]
fn system_local_peer_id(&self) -> Receiver<String>;
/// Returns the multiaddresses that the local node is listening on
///
/// The addresses include a trailing `/p2p/` with the local PeerId, and are thus suitable to
/// be passed to `system_addReservedPeer` or as a bootnode address for example.
#[rpc(name = "system_localListenAddresses", returns = "Vec<String>")]
fn system_local_listen_addresses(&self) -> Receiver<Vec<String>>;
/// Returns currently connected peers
#[rpc(name = "system_peers", returns = "Vec<PeerInfo<Hash, Number>>")]
fn system_peers(&self) -> Receiver<Vec<PeerInfo<Hash, Number>>>;