chore: move client constant to primitives (#2220)

Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
Matthias Seitz
2023-04-13 16:48:17 +02:00
committed by GitHub
parent 5e64f0e079
commit 2f003bf8ae
2 changed files with 5 additions and 5 deletions

View File

@ -1,14 +1,11 @@
use crate::{capability::Capability, EthVersion, ProtocolVersion};
use reth_codecs::derive_arbitrary;
use reth_primitives::PeerId;
use reth_primitives::{constants::RETH_CLIENT_VERSION, PeerId};
use reth_rlp::{RlpDecodable, RlpEncodable};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// The client version: `reth/v{major}.{minor}.{patch}`
pub(crate) const DEFAULT_CLIENT_VERSION: &str = concat!("reth/v", env!("CARGO_PKG_VERSION"));
// TODO: determine if we should allow for the extra fields at the end like EIP-706 suggests
/// Message used in the `p2p` handshake, containing information about the supported RLPx protocol
/// version and capabilities.
@ -98,7 +95,7 @@ impl HelloMessageBuilder {
let Self { protocol_version, client_version, capabilities, port, id } = self;
HelloMessage {
protocol_version: protocol_version.unwrap_or_default(),
client_version: client_version.unwrap_or_else(|| DEFAULT_CLIENT_VERSION.to_string()),
client_version: client_version.unwrap_or_else(|| RETH_CLIENT_VERSION.to_string()),
capabilities: capabilities.unwrap_or_else(|| {
vec![EthVersion::Eth68.into(), EthVersion::Eth67.into(), EthVersion::Eth66.into()]
}),