Skip to main content

NetworkBlock

Trait NetworkBlock 

Source
pub trait NetworkBlock<BlockHash, BlockNumber> {
    // Required methods
    fn announce_block(&self, hash: BlockHash, data: Option<Vec<u8>>);
    fn new_best_block_imported(&self, hash: BlockHash, number: BlockNumber);
}
Expand description

Provides ability to announce blocks to the network.

Required Methods§

Source

fn announce_block(&self, hash: BlockHash, data: Option<Vec<u8>>)

Make sure an important block is propagated to peers.

In chain-based consensus, we often need to make sure non-best forks are at least temporarily synced. This function forces such an announcement.

Source

fn new_best_block_imported(&self, hash: BlockHash, number: BlockNumber)

Inform the network service about new best imported block.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, BlockHash, BlockNumber> NetworkBlock<BlockHash, BlockNumber> for Arc<T>
where T: ?Sized + NetworkBlock<BlockHash, BlockNumber>,

Source§

fn announce_block(&self, hash: BlockHash, data: Option<Vec<u8>>)

Source§

fn new_best_block_imported(&self, hash: BlockHash, number: BlockNumber)

Implementors§