pub trait PeerToPeerPort {
// Required methods
fn height_stream(&self) -> BoxStream<BlockHeight>;
fn get_sealed_block_headers<'life0, 'async_trait>(
&'life0 self,
block_height_range: Range<u32>,
) -> Pin<Box<dyn Future<Output = Result<SourcePeer<Option<Vec<SealedBlockHeader>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_transactions<'life0, 'async_trait>(
&'life0 self,
block_ids: SourcePeer<Range<u32>>,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Transactions>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn report_peer(&self, peer: PeerId, report: PeerReportReason) -> Result<()>;
}
Expand description
Port for communication with the network.
Required Methods§
Sourcefn height_stream(&self) -> BoxStream<BlockHeight>
fn height_stream(&self) -> BoxStream<BlockHeight>
Stream of newly observed block heights.
Sourcefn get_sealed_block_headers<'life0, 'async_trait>(
&'life0 self,
block_height_range: Range<u32>,
) -> Pin<Box<dyn Future<Output = Result<SourcePeer<Option<Vec<SealedBlockHeader>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_sealed_block_headers<'life0, 'async_trait>(
&'life0 self,
block_height_range: Range<u32>,
) -> Pin<Box<dyn Future<Output = Result<SourcePeer<Option<Vec<SealedBlockHeader>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request a range of sealed block headers from the network.
Sourcefn get_transactions<'life0, 'async_trait>(
&'life0 self,
block_ids: SourcePeer<Range<u32>>,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Transactions>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_transactions<'life0, 'async_trait>(
&'life0 self,
block_ids: SourcePeer<Range<u32>>,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Transactions>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request transactions from the network for the given block and source peer.
Sourcefn report_peer(&self, peer: PeerId, report: PeerReportReason) -> Result<()>
fn report_peer(&self, peer: PeerId, report: PeerReportReason) -> Result<()>
Report a peer for some reason to modify their reputation.