Skip to main content

FinalizationMessage

Struct FinalizationMessage 

Source
pub struct FinalizationMessage {
    pub round: FinalizationRound,
    pub is_prevote: bool,
    pub height: u64,
    pub hashes: Vec<Hash256>,
    /* private fields */
}
Expand description

投票のメッセージ1つ。ノードどうしが確定の前に配り合うもので、証明はこれを段階と高さとハッシュごとにまとめたもの

Fields§

§round: FinalizationRound§is_prevote: bool§height: u64

最初のハッシュのブロックの高さ

§hashes: Vec<Hash256>

高さ height から続くブロックのハッシュ

Implementations§

Source§

impl FinalizationMessage

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, ProofError>

バイト列から読む。署名は確かめない(FinalizationMessage::verify_signature)。 予約が 0 でないものと、版が 1 でないものは、catapult も受け付けないので読まない

Source

pub fn sign( round: FinalizationRound, is_prevote: bool, height: u64, hashes: Vec<Hash256>, sign: impl FnOnce(&[u8]) -> Option<[u8; 192]>, ) -> Option<Self>

署名したメッセージを作る。sign は署名するところ(FinalizationMessage::signed_part と同じもの)を受け取り、 エポック round.epoch の鍵での BmTreeSignature を返す。署名できなければ None

Source

pub fn to_bytes(&self) -> Vec<u8> ⓘ

catapult と同じバイト列

Source

pub fn size(&self) -> usize

バイト列の長さ

Source

pub fn root_key(&self) -> [u8; 32]

投票の鍵(BM ツリーの根の公開鍵)。super::proof::VotingSet の鍵と同じもの

Source

pub fn last_height(&self) -> u64

最後のハッシュのブロックの高さ

Source

pub fn hash(&self) -> [u8; 32]

catapult の CalculateMessageHash。バイト列全体の SHA3-256

Source

pub fn short_hash(&self) -> u32

catapult の utils::ToShortHash。ハッシュの先頭4バイトを u32 として読んだもの

Source

pub fn verify_signature(&self) -> bool

根の鍵がこのエポックの下の鍵に、下の鍵がメッセージに署名しているか

Source

pub fn signed_part(&self) -> Vec<u8> ⓘ

署名するところ。版、ハッシュの数、エポック、ポイントと段階、高さ、ハッシュ

Trait Implementations§

Source§

impl Clone for FinalizationMessage

Source§

fn clone(&self) -> FinalizationMessage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FinalizationMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FinalizationMessage

Source§

impl PartialEq for FinalizationMessage

Source§

fn eq(&self, other: &FinalizationMessage) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FinalizationMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.