pub struct SignedBlockHeader { /* private fields */ }Expand description
A block header and collection of signatures of a given block.
Implementations§
Source§impl SignedBlockHeader
impl SignedBlockHeader
Sourcepub fn new(block_header: BlockHeader, block_signatures: BlockSignatures) -> Self
pub fn new(block_header: BlockHeader, block_signatures: BlockSignatures) -> Self
Returns a new SignedBlockHeader.
Sourcepub fn block_header(&self) -> &BlockHeader
pub fn block_header(&self) -> &BlockHeader
Returns the block header.
Sourcepub fn block_signatures(&self) -> &BlockSignatures
pub fn block_signatures(&self) -> &BlockSignatures
Returns the block signatures.
Sourcepub fn is_valid(&self) -> Result<(), SignedBlockHeaderValidationError>
pub fn is_valid(&self) -> Result<(), SignedBlockHeaderValidationError>
Returns Ok if and only if the block hash and era ID in the BlockHeader are identical to
those in the BlockSignatures.
Note that no cryptographic verification of the contained signatures is performed. For this,
see BlockSignatures::is_verified.
Sourcepub fn invalidate_era(&mut self)
Available on crate feature testing only.
pub fn invalidate_era(&mut self)
testing only.Sets the era ID contained in block_signatures to its max value, rendering it and hence
self invalid (assuming the relevant era ID for this SignedBlockHeader wasn’t already
the max value).
Sourcepub fn invalidate_last_signature(&mut self)
Available on crate feature testing only.
pub fn invalidate_last_signature(&mut self)
testing only.Replaces the signature field of the last block_signatures entry with the System variant
of crate::crypto::Signature, rendering that entry invalid.
Note that Self::is_valid will be unaffected by this as it only checks for equality in
the block hash and era ID of the header and signatures; no cryptographic verification is
performed.
Trait Implementations§
Source§impl Clone for SignedBlockHeader
impl Clone for SignedBlockHeader
Source§fn clone(&self) -> SignedBlockHeader
fn clone(&self) -> SignedBlockHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSize for SignedBlockHeader
impl DataSize for SignedBlockHeader
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl Debug for SignedBlockHeader
impl Debug for SignedBlockHeader
Source§impl<'de> Deserialize<'de> for SignedBlockHeader
impl<'de> Deserialize<'de> for SignedBlockHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SignedBlockHeader
impl Display for SignedBlockHeader
Source§impl PartialEq for SignedBlockHeader
impl PartialEq for SignedBlockHeader
Source§impl Serialize for SignedBlockHeader
impl Serialize for SignedBlockHeader
impl Eq for SignedBlockHeader
impl StructuralPartialEq for SignedBlockHeader
Auto Trait Implementations§
impl !Freeze for SignedBlockHeader
impl RefUnwindSafe for SignedBlockHeader
impl Send for SignedBlockHeader
impl Sync for SignedBlockHeader
impl Unpin for SignedBlockHeader
impl UnwindSafe for SignedBlockHeader
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
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§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
key and return true if they are equal.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
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>
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