mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-16 09:56:17 -05:00
chore(net): add negotiated eth version to events (#1478)
This commit is contained in:
@@ -7,7 +7,7 @@ use reth_ecies::{stream::ECIESStream, ECIESError};
|
||||
use reth_eth_wire::{
|
||||
capability::{Capabilities, CapabilityMessage},
|
||||
errors::EthStreamError,
|
||||
DisconnectReason, EthStream, P2PStream, Status,
|
||||
DisconnectReason, EthStream, EthVersion, P2PStream, Status,
|
||||
};
|
||||
use reth_net_common::bandwidth_meter::MeteredStream;
|
||||
use reth_primitives::PeerId;
|
||||
@@ -51,6 +51,8 @@ pub(crate) struct ActiveSessionHandle {
|
||||
pub(crate) direction: Direction,
|
||||
/// The assigned id for this session
|
||||
pub(crate) session_id: SessionId,
|
||||
/// negotiated eth version
|
||||
pub(crate) version: EthVersion,
|
||||
/// The identifier of the remote peer
|
||||
pub(crate) remote_id: PeerId,
|
||||
/// The timestamp when the session has been established.
|
||||
|
||||
@@ -17,7 +17,7 @@ use reth_ecies::{stream::ECIESStream, ECIESError};
|
||||
use reth_eth_wire::{
|
||||
capability::{Capabilities, CapabilityMessage},
|
||||
errors::EthStreamError,
|
||||
DisconnectReason, HelloMessage, Status, UnauthedEthStream, UnauthedP2PStream,
|
||||
DisconnectReason, EthVersion, HelloMessage, Status, UnauthedEthStream, UnauthedP2PStream,
|
||||
};
|
||||
use reth_metrics_common::metered_sender::MeteredSender;
|
||||
use reth_net_common::{
|
||||
@@ -434,6 +434,9 @@ impl SessionManager {
|
||||
self.initial_internal_request_timeout.as_millis() as u64,
|
||||
));
|
||||
|
||||
// negotiated version
|
||||
let version = conn.version();
|
||||
|
||||
let session = ActiveSession {
|
||||
next_id: 0,
|
||||
remote_peer_id: peer_id,
|
||||
@@ -461,6 +464,7 @@ impl SessionManager {
|
||||
direction,
|
||||
session_id,
|
||||
remote_id: peer_id,
|
||||
version,
|
||||
established: Instant::now(),
|
||||
capabilities: Arc::clone(&capabilities),
|
||||
commands_to_session,
|
||||
@@ -474,6 +478,7 @@ impl SessionManager {
|
||||
Poll::Ready(SessionEvent::SessionEstablished {
|
||||
peer_id,
|
||||
remote_addr,
|
||||
version,
|
||||
capabilities,
|
||||
status,
|
||||
messages,
|
||||
@@ -590,6 +595,8 @@ pub(crate) enum SessionEvent {
|
||||
peer_id: PeerId,
|
||||
remote_addr: SocketAddr,
|
||||
capabilities: Arc<Capabilities>,
|
||||
/// negotiated eth version
|
||||
version: EthVersion,
|
||||
status: Status,
|
||||
messages: PeerRequestSender,
|
||||
direction: Direction,
|
||||
|
||||
Reference in New Issue
Block a user