Skip to main content

ChainEvent

Enum ChainEvent 

Source
pub enum ChainEvent {
    Statistics {
        peer: PeerId,
        statistics: ChainStatistics,
    },
    Blocks {
        peer: PeerId,
        from: u64,
        count: u32,
        blocks: Vec<(Block, Vec<u8>)>,
    },
    Hashes {
        peer: PeerId,
        from: u64,
        count: u32,
        hashes: Vec<[u8; 32]>,
    },
    Finalized {
        peer: PeerId,
        header: FinalizedBlockHeader,
    },
    OwnProof {
        epoch: u32,
        proof: Vec<u8>,
    },
    Proof {
        peer: PeerId,
        epoch: u32,
        proof: Option<Vec<u8>>,
    },
    Failed {
        peer: PeerId,
        error: String,
        malformed: bool,
    },
    PeerAdded {
        peer: PeerId,
    },
    PeerLost {
        peer: PeerId,
    },
    Wake,
    Pushed {
        block: Box<Block>,
        bytes: Vec<u8>,
        from: Option<PublicKey>,
    },
    Tick,
}
Expand description

チェーンの持ち主の受信箱

Variants§

§

Statistics

Fields

§peer: PeerId
§statistics: ChainStatistics
§

Blocks

頼んだ範囲のブロック。前後に依らない確かめは済んでいる。ノードは数を切り詰めることがある

Fields

§peer: PeerId
§from: u64
§count: u32
§blocks: Vec<(Block, Vec<u8>)>
§

Hashes

頼んだ高さからのブロックのハッシュ

Fields

§peer: PeerId
§from: u64
§count: u32
§hashes: Vec<[u8; 32]>
§

Finalized

ピアの言う最新のファイナライズ(エポック、ポイント、高さ、ハッシュ)

Fields

§peer: PeerId
§

OwnProof

自分で投票を数えて組んだ証明(ファイナライズを見ているとき)。ピアの証明と同じに確かめてしまう

Fields

§epoch: u32
§proof: Vec<u8>
§

Proof

頼んだエポックの証明。まだなければ None

Fields

§peer: PeerId
§epoch: u32
§proof: Option<Vec<u8>>
§

Failed

頼んだことができなかった。malformed なら、状態を見ない確かめに落ちるもの(形、署名)が返ってきた。 そうでなければ、通信に失敗した

Fields

§peer: PeerId
§error: String
§malformed: bool
§

PeerAdded

駆動役が新しいピア peer とやりとりを始めた

Fields

§peer: PeerId
§

PeerLost

駆動役が自分の都合(入れ替えなど)でピア peer を外した

Fields

§peer: PeerId
§

Wake

頼んだ時刻(crate::chain::Action::WakeAt)になった

§

Pushed

接続してきたピアが押し付けたブロック。前後に依らない確かめは済んでいる。from は押し付けた相手の鍵。 REST(PUT /blocks)で届いたものは None で、弾いても罰さない

Fields

§block: Box<Block>
§bytes: Vec<u8>
§

Tick

決まった間隔で入れる。ピアに統計を聞き直し、押し付けのまとめを出す

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.