pub struct UnifiedStatus {
pub version: EthVersion,
pub chain: Chain,
pub genesis: B256,
pub forkid: ForkId,
pub blockhash: B256,
pub total_difficulty: Option<U256>,
pub earliest_block: Option<u64>,
pub latest_block: Option<u64>,
}Expand description
UnifiedStatus is an internal superset of all ETH status fields for all eth/ versions.
This type can be converted into Status or StatusEth69 depending on the version and
unsupported fields are stripped out.
Fields§
§version: EthVersionThe eth protocol version (e.g. eth/66 to eth/70).
chain: ChainThe chain ID identifying the peer’s network.
genesis: B256The genesis block hash of the peer’s chain.
forkid: ForkIdThe fork ID as defined by EIP-2124.
blockhash: B256The latest block hash known to the peer.
total_difficulty: Option<U256>The total difficulty of the peer’s best chain (eth/66–68 only).
earliest_block: Option<u64>The earliest block this node can serve (eth/69 only).
latest_block: Option<u64>The latest block number this node has (eth/69 only).
Implementations§
Source§impl UnifiedStatus
impl UnifiedStatus
Sourcepub fn builder() -> StatusBuilder
pub fn builder() -> StatusBuilder
Helper for creating the UnifiedStatus builder
Sourcepub fn spec_builder<Spec>(spec: &Spec, head: &Head) -> Selfwhere
Spec: EthChainSpec + Hardforks,
pub fn spec_builder<Spec>(spec: &Spec, head: &Head) -> Selfwhere
Spec: EthChainSpec + Hardforks,
Build from chain‑spec + head. Earliest/latest default to full history.
Sourcepub const fn set_history_range(&mut self, earliest: u64, latest: u64)
pub const fn set_history_range(&mut self, earliest: u64, latest: u64)
Override the (earliest, latest) history range we’ll advertise to
eth/69 peers.
Sourcepub fn block_range_update(&self) -> Option<BlockRangeUpdate>
pub fn block_range_update(&self) -> Option<BlockRangeUpdate>
Returns the peer’s advertised BlockRangeUpdate if this status came from an eth/69+
handshake.
Sourcepub const fn set_eth_version(&mut self, v: EthVersion)
pub const fn set_eth_version(&mut self, v: EthVersion)
Sets the EthVersion for the status.
Sourcepub fn into_legacy(self) -> Status
pub fn into_legacy(self) -> Status
Consume this UnifiedStatus and produce the legacy Status message used by all
eth/66–eth/68.
Sourcepub fn into_eth69(self) -> StatusEth69
pub fn into_eth69(self) -> StatusEth69
Consume this UnifiedStatus and produce the StatusEth69 message used by eth/69.
Sourcepub fn into_message(self) -> StatusMessage
pub fn into_message(self) -> StatusMessage
Convert this UnifiedStatus into the appropriate StatusMessage variant based on version.
Sourcepub const fn from_message(msg: StatusMessage) -> Self
pub const fn from_message(msg: StatusMessage) -> Self
Build a UnifiedStatus from a received StatusMessage.
Trait Implementations§
Source§impl Clone for UnifiedStatus
impl Clone for UnifiedStatus
impl Copy for UnifiedStatus
Source§impl Debug for UnifiedStatus
impl Debug for UnifiedStatus
Source§impl Default for UnifiedStatus
impl Default for UnifiedStatus
impl Eq for UnifiedStatus
Source§impl PartialEq for UnifiedStatus
impl PartialEq for UnifiedStatus
impl StructuralPartialEq for UnifiedStatus
Auto Trait Implementations§
impl Freeze for UnifiedStatus
impl RefUnwindSafe for UnifiedStatus
impl Send for UnifiedStatus
impl Sync for UnifiedStatus
impl Unpin for UnifiedStatus
impl UnsafeUnpin for UnifiedStatus
impl UnwindSafe for UnifiedStatus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 176 bytes