Externalize Grin User Agent (#880)

Take the version from the root Cargo.toml
Fixes #875
This commit is contained in:
hashmap 2018-03-27 14:52:59 +02:00 committed by Yeastplume
parent 99804a6485
commit e32d353543
2 changed files with 4 additions and 2 deletions

View file

@ -31,8 +31,8 @@ use types::*;
/// Current latest version of the protocol
pub const PROTOCOL_VERSION: u32 = 1;
/// Grin's user agent with current version (TODO externalize)
pub const USER_AGENT: &'static str = "MW/Grin 0.1";
/// Grin's user agent with current version
pub const USER_AGENT: &'static str = concat!("MW/Grin ", env!("CARGO_PKG_VERSION"));
/// Magic number expected in the header of every message
const MAGIC: [u8; 2] = [0x1e, 0xc5];

View file

@ -76,6 +76,8 @@ fn peer_handshake() {
net_adapter,
).unwrap();
assert!(peer.info.user_agent.ends_with(env!("CARGO_PKG_VERSION")));
peer.start(socket);
thread::sleep(time::Duration::from_secs(1));