pub enum Message<N: Network> {
Show 13 variants
BlockRequest(BlockRequest),
BlockResponse(BlockResponse<N>),
ChallengeRequest(ChallengeRequest<N>),
ChallengeResponse(ChallengeResponse<N>),
Disconnect(Disconnect),
PeerRequest(PeerRequest),
PeerResponse(PeerResponse),
Ping(Ping<N>),
Pong(Pong),
PuzzleRequest(PuzzleRequest),
PuzzleResponse(PuzzleResponse<N>),
UnconfirmedSolution(UnconfirmedSolution<N>),
UnconfirmedTransaction(UnconfirmedTransaction<N>),
}
Variants§
BlockRequest(BlockRequest)
BlockResponse(BlockResponse<N>)
ChallengeRequest(ChallengeRequest<N>)
ChallengeResponse(ChallengeResponse<N>)
Disconnect(Disconnect)
PeerRequest(PeerRequest)
PeerResponse(PeerResponse)
Ping(Ping<N>)
Pong(Pong)
PuzzleRequest(PuzzleRequest)
PuzzleResponse(PuzzleResponse<N>)
UnconfirmedSolution(UnconfirmedSolution<N>)
UnconfirmedTransaction(UnconfirmedTransaction<N>)
Implementations§
Source§impl<N: Network> Message<N>
impl<N: Network> Message<N>
Sourcepub const VERSIONS: [(ConsensusVersion, u32); 4]
pub const VERSIONS: [(ConsensusVersion, u32); 4]
The version of the network protocol; this is incremented for breaking changes between migration versions.
Sourcepub fn latest_message_version() -> u32
pub fn latest_message_version() -> u32
Returns the latest message version.
Sourcepub fn lowest_accepted_message_version(current_block_height: u32) -> u32
pub fn lowest_accepted_message_version(current_block_height: u32) -> u32
Returns the lowest acceptable message version for the given block height.
Example scenario:
At block height X
, the protocol upgrades to message version from Y-1
to Y
.
Client A upgrades and starts using message version Y
.
Client B has not upgraded and still uses message version Y-1
.
Until block X
, they stay connected and can communicate.
After block X
, Client A will reject messages from Client B.
Sourcepub fn check_size(bytes: &[u8]) -> Result<()>
pub fn check_size(bytes: &[u8]) -> Result<()>
Checks the message byte length. To be used before deserialization.
Trait Implementations§
Source§impl<N: Network> From<DisconnectReason> for Message<N>
impl<N: Network> From<DisconnectReason> for Message<N>
Source§fn from(reason: DisconnectReason) -> Self
fn from(reason: DisconnectReason) -> Self
Converts to this type from the input type.
impl<N: Eq + Network> Eq for Message<N>
impl<N: Network> StructuralPartialEq for Message<N>
Auto Trait Implementations§
impl<N> !Freeze for Message<N>
impl<N> RefUnwindSafe for Message<N>where
<N as Network>::BlockHash: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
<N as Network>::StateRoot: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
N: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
<N as Network>::TransitionID: RefUnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe,
<N as Network>::RatificationID: RefUnwindSafe,
<N as Network>::TransmissionChecksum: RefUnwindSafe,
impl<N> Send for Message<N>
impl<N> Sync for Message<N>
impl<N> Unpin for Message<N>where
<N as Network>::BlockHash: Unpin,
<N as Network>::TransactionID: Unpin,
<N as Network>::StateRoot: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
N: Unpin,
<N as Environment>::Scalar: Unpin,
<N as Network>::TransitionID: Unpin,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin,
<N as Network>::RatificationID: Unpin,
impl<N> UnwindSafe for Message<N>where
<N as Network>::BlockHash: UnwindSafe,
<N as Network>::TransactionID: UnwindSafe + RefUnwindSafe,
<N as Network>::StateRoot: UnwindSafe,
<N as Environment>::Field: UnwindSafe + RefUnwindSafe,
<N as Environment>::Projective: UnwindSafe + RefUnwindSafe,
N: UnwindSafe + RefUnwindSafe,
<N as Environment>::Scalar: UnwindSafe + RefUnwindSafe,
<N as Network>::TransitionID: UnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe + RefUnwindSafe,
<N as Network>::RatificationID: UnwindSafe,
<N as Network>::TransmissionChecksum: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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