Remove HostInfo::client_version() and secret() (#8677)

This commit is contained in:
Pierre Krieger 2018-05-22 06:32:05 +02:00 committed by Marek Kotewicz
parent 3fde07b2e1
commit 84ecab0eaf
3 changed files with 10 additions and 13 deletions

View File

@ -26,7 +26,8 @@ use node_table::NodeId;
use io::{IoContext, StreamToken};
use ethkey::{KeyPair, Public, Secret, recover, sign, Generator, Random};
use ethkey::crypto::{ecdh, ecies};
use network::{Error, ErrorKind, HostInfo};
use network::{Error, ErrorKind, HostInfo as HostInfoTrait};
use host::HostInfo;
#[derive(PartialEq, Eq, Debug)]
enum HandshakeState {

View File

@ -215,20 +215,20 @@ impl HostInfo {
self.nonce = keccak(&self.nonce);
self.nonce
}
pub(crate) fn client_version(&self) -> &str {
&self.config.client_version
}
pub(crate) fn secret(&self) -> &Secret {
self.keys.secret()
}
}
impl HostInfoTrait for HostInfo {
fn id(&self) -> &NodeId {
self.keys.public()
}
fn secret(&self) -> &Secret {
self.keys.secret()
}
fn client_version(&self) -> &str {
&self.config.client_version
}
}
type SharedSession = Arc<Mutex<Session>>;

View File

@ -330,10 +330,6 @@ impl<'a, T> NetworkContext for &'a T where T: ?Sized + NetworkContext {
pub trait HostInfo {
/// Returns public key
fn id(&self) -> &NodeId;
/// Returns secret key
fn secret(&self) -> &Secret;
/// Returns the client version.
fn client_version(&self) -> &str;
}
/// Network IO protocol handler. This needs to be implemented for each new subprotocol.