pub trait Block: Decidable + Send + Sync {
    // Required methods
    fn bytes<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = &[u8]> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn height<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn timestamp<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn parent<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Id> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Required Methods§

source

fn bytes<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = &[u8]> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the binary representation of this block.

This is used for sending blocks to peers. The bytes should be able to be parsed into the same block on another node.

source

fn height<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the height of the block in the chain.

source

fn timestamp<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Time this block was proposed at. This value should be consistent across all nodes. If this block hasn’t been successfully verified, any value can be returned. If this block is the last accepted block, the timestamp must be returned correctly. Otherwise, accepted blocks can return any value.

source

fn parent<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Id> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the ID of this block’s parent.

source

fn verify<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns error if the block can not be verified.

Implementors§