pub enum BlockSignatures {
V1(BlockSignaturesV1),
V2(BlockSignaturesV2),
}Expand description
A collection of signatures for a single block, along with the associated block’s hash and era ID.
Variants§
V1(BlockSignaturesV1)
Version 1 of the block signatures.
V2(BlockSignaturesV2)
Version 2 of the block signatures.
Implementations§
Source§impl BlockSignatures
impl BlockSignatures
Sourcepub fn block_hash(&self) -> &BlockHash
pub fn block_hash(&self) -> &BlockHash
Returns the block hash of the associated block.
Sourcepub fn finality_signature(
&self,
public_key: &PublicKey,
) -> Option<FinalitySignature>
pub fn finality_signature( &self, public_key: &PublicKey, ) -> Option<FinalitySignature>
Returns the finality signature associated with the given public key, if available.
Sourcepub fn has_finality_signature(&self, public_key: &PublicKey) -> bool
pub fn has_finality_signature(&self, public_key: &PublicKey) -> bool
Returns true if there is a signature associated with the given public key.
Sourcepub fn finality_signatures(
&self,
) -> impl Iterator<Item = FinalitySignature> + '_
pub fn finality_signatures( &self, ) -> impl Iterator<Item = FinalitySignature> + '_
Returns an iterator over all the signatures.
Sourcepub fn proofs(&self) -> &BTreeMap<PublicKey, Signature>
pub fn proofs(&self) -> &BTreeMap<PublicKey, Signature>
Returns an BTreeMap of public keys to signatures.
Sourcepub fn signers(&self) -> impl Iterator<Item = &PublicKey> + '_
pub fn signers(&self) -> impl Iterator<Item = &PublicKey> + '_
Returns an iterator over all the validator public keys.
Sourcepub fn merge(&mut self, other: Self) -> Result<(), BlockSignaturesMergeError>
pub fn merge(&mut self, other: Self) -> Result<(), BlockSignaturesMergeError>
Merges the collection of signatures in other into self.
Returns an error if the block hashes, block heights, era IDs, or chain name hashes do not match.
Sourcepub fn is_verified(&self) -> Result<(), Error>
pub fn is_verified(&self) -> Result<(), Error>
Returns Ok if and only if all the signatures are cryptographically valid.
Sourcepub fn into_proofs(self) -> BTreeMap<PublicKey, Signature>
pub fn into_proofs(self) -> BTreeMap<PublicKey, Signature>
Converts self into a BTreeMap of public keys to signatures.
Sourcepub fn insert_signature(&mut self, public_key: PublicKey, signature: Signature)
pub fn insert_signature(&mut self, public_key: PublicKey, signature: Signature)
Inserts a new signature.
Sourcepub fn remove_signature(&mut self, public_key: &PublicKey) -> Option<Signature>
pub fn remove_signature(&mut self, public_key: &PublicKey) -> Option<Signature>
Removes a signature corresponding to the specified key.
Sourcepub fn invalidate_era(&mut self)
Available on crate feature testing only.
pub fn invalidate_era(&mut self)
testing only.Sets the era ID to its max value, rendering it and hence self invalid (assuming the
relevant era ID for this BlockHeaderWithSignatures 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 proofs entry with the System variant
of Signature, rendering that entry invalid.
Trait Implementations§
Source§impl Clone for BlockSignatures
impl Clone for BlockSignatures
Source§fn clone(&self) -> BlockSignatures
fn clone(&self) -> BlockSignatures
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSize for BlockSignatures
impl DataSize for BlockSignatures
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 BlockSignatures
impl Debug for BlockSignatures
Source§impl<'de> Deserialize<'de> for BlockSignatures
impl<'de> Deserialize<'de> for BlockSignatures
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 BlockSignatures
impl Display for BlockSignatures
Source§impl From<BlockSignaturesV1> for BlockSignatures
impl From<BlockSignaturesV1> for BlockSignatures
Source§fn from(block_signatures: BlockSignaturesV1) -> Self
fn from(block_signatures: BlockSignaturesV1) -> Self
Source§impl From<BlockSignaturesV2> for BlockSignatures
impl From<BlockSignaturesV2> for BlockSignatures
Source§fn from(block_signatures: BlockSignaturesV2) -> Self
fn from(block_signatures: BlockSignaturesV2) -> Self
Source§impl FromBytes for BlockSignatures
impl FromBytes for BlockSignatures
Source§impl Hash for BlockSignatures
impl Hash for BlockSignatures
Source§impl Ord for BlockSignatures
impl Ord for BlockSignatures
Source§fn cmp(&self, other: &BlockSignatures) -> Ordering
fn cmp(&self, other: &BlockSignatures) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BlockSignatures
impl PartialEq for BlockSignatures
Source§impl PartialOrd for BlockSignatures
impl PartialOrd for BlockSignatures
Source§impl Serialize for BlockSignatures
impl Serialize for BlockSignatures
Source§impl ToBytes for BlockSignatures
impl ToBytes for BlockSignatures
Source§fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
&self into a mutable writer.Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8> which would be returned from a successful call to
to_bytes() or into_bytes(). The data is not actually serialized, so this call is
relatively cheap.impl Eq for BlockSignatures
impl StructuralPartialEq for BlockSignatures
Auto Trait Implementations§
impl Freeze for BlockSignatures
impl RefUnwindSafe for BlockSignatures
impl Send for BlockSignatures
impl Sync for BlockSignatures
impl Unpin for BlockSignatures
impl UnwindSafe for BlockSignatures
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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