Trait sc_network::service::traits::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.

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§