pub enum BlockSource<N: Network> {
Announced {
header_id: N::PubsubId,
body_id: Option<N::PubsubId>,
},
Requested {
id: N::PeerId,
},
}Expand description
Describes the origin of a block
Variants§
Implementations§
Source§impl<N: Network> BlockSource<N>
impl<N: Network> BlockSource<N>
Sourcepub fn announced(header_id: N::PubsubId, body_id: Option<N::PubsubId>) -> Self
pub fn announced(header_id: N::PubsubId, body_id: Option<N::PubsubId>) -> Self
Creates a BlockSource for an announced block
Sourcepub fn is_announced(&self) -> bool
pub fn is_announced(&self) -> bool
Returns true if the block was received via announcement.
Sourcepub fn is_requested(&self) -> bool
pub fn is_requested(&self) -> bool
Returns true if the block was received as a direct response to a request.
Sourcepub fn accept_block(&self, network: &N)
pub fn accept_block(&self, network: &N)
Marks the block as accepted.
Sourcepub fn reject_block(&self, network: &N)
pub fn reject_block(&self, network: &N)
Marks the block as rejected
Sourcepub fn ignore_block(&self, network: &N)
pub fn ignore_block(&self, network: &N)
Marks the block as ignored.
Sourcepub fn validate_block(&self, network: &N, acceptance: MsgAcceptance)
pub fn validate_block(&self, network: &N, acceptance: MsgAcceptance)
Applies the given acceptance decision to the associated network messages for blocks received via gossip.
Trait Implementations§
Source§impl<N: Network> Clone for BlockSource<N>
impl<N: Network> Clone for BlockSource<N>
Auto Trait Implementations§
impl<N> Freeze for BlockSource<N>
impl<N> RefUnwindSafe for BlockSource<N>where
<N as Network>::PubsubId: RefUnwindSafe,
Option<<N as Network>::PubsubId>: RefUnwindSafe,
<N as Network>::PeerId: RefUnwindSafe,
impl<N> Send for BlockSource<N>
impl<N> Sync for BlockSource<N>
impl<N> Unpin for BlockSource<N>
impl<N> UnsafeUnpin for BlockSource<N>where
<N as Network>::PubsubId: UnsafeUnpin,
Option<<N as Network>::PubsubId>: UnsafeUnpin,
<N as Network>::PeerId: UnsafeUnpin,
impl<N> UnwindSafe for BlockSource<N>where
<N as Network>::PubsubId: UnwindSafe,
Option<<N as Network>::PubsubId>: UnwindSafe,
<N as Network>::PeerId: UnwindSafe,
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<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