diff --git a/p2p/src/msg.rs b/p2p/src/msg.rs index d3f948f13..0a17d70cb 100644 --- a/p2p/src/msg.rs +++ b/p2p/src/msg.rs @@ -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]; diff --git a/p2p/tests/peer_handshake.rs b/p2p/tests/peer_handshake.rs index 4e81cad3b..90be2f1c1 100644 --- a/p2p/tests/peer_handshake.rs +++ b/p2p/tests/peer_handshake.rs @@ -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));