Add RPC enode lookup (#3096)

* add enode rpc

* spaces -> tabs
This commit is contained in:
keorn
2016-11-02 18:43:21 +00:00
committed by Gav Wood
parent cf8f27ce0f
commit 36d17d5c28
5 changed files with 28 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ pub trait SyncProvider: Send + Sync {
/// Get peers information
fn peers(&self) -> Vec<PeerInfo>;
/// Get the enode if available.
fn enode(&self) -> Option<String>;
}
/// Peer connection information
@@ -143,6 +146,10 @@ impl SyncProvider for EthSync {
self.handler.sync.write().peers(&sync_io)
}).unwrap_or(Vec::new())
}
fn enode(&self) -> Option<String> {
self.network.external_url()
}
}
struct SyncProtocolHandler {