mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 02:11:01 +00:00
Extract consensus_gossip.rs and put it in its own crate (#4284)
* Extract gossiping system from network * Finish porting GRANDPA tests * Try put correct engine ID * Fix messages encoding * Fix communication tests * Use a threads pool to spawn stuff * Fix compilation everywhere * Fix bad merge conflict * Remove dependency on async-std * Apply suggestions from code review Co-Authored-By: Robert Habermeier <rphmeier@gmail.com> * More suggestions * Remove network startup GP future * Update to futures_timer * adjust wait_when_behind test * Pass correct Roles after handshake * Revert "adjust wait_when_behind test" This reverts commit 23cb3a0a6d25ed732c2cd648607bc44ef2ab0919. * Crate root documentation * Remove MessageRecipient * Address concerns * Fix more concerns * Forgot Cargo.lock
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
//! We only send polite messages to peers,
|
||||
|
||||
use sp_runtime::traits::{NumberFor, Block as BlockT, Zero};
|
||||
use network::consensus_gossip::{self as network_gossip, MessageIntent, ValidatorContext};
|
||||
use network_gossip::{GossipEngine, MessageIntent, ValidatorContext};
|
||||
use network::{config::Roles, PeerId, ReputationChange};
|
||||
use codec::{Encode, Decode};
|
||||
use fg_primitives::AuthorityId;
|
||||
@@ -1459,29 +1459,26 @@ pub(super) struct ReportStream {
|
||||
impl ReportStream {
|
||||
/// Consume the report stream, converting it into a future that
|
||||
/// handles all reports.
|
||||
pub(super) fn consume<B, N>(self, net: N)
|
||||
pub(super) fn consume<B>(self, net: GossipEngine<B>)
|
||||
-> impl Future<Item=(),Error=()> + Send + 'static
|
||||
where
|
||||
B: BlockT,
|
||||
N: super::Network<B> + Send + 'static,
|
||||
{
|
||||
ReportingTask {
|
||||
reports: self.reports,
|
||||
net,
|
||||
_marker: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A future for reporting peers.
|
||||
#[must_use = "Futures do nothing unless polled"]
|
||||
struct ReportingTask<B, N> {
|
||||
struct ReportingTask<B: BlockT> {
|
||||
reports: mpsc::UnboundedReceiver<PeerReport>,
|
||||
net: N,
|
||||
_marker: std::marker::PhantomData<B>,
|
||||
net: GossipEngine<B>,
|
||||
}
|
||||
|
||||
impl<B: BlockT, N: super::Network<B>> Future for ReportingTask<B, N> {
|
||||
impl<B: BlockT> Future for ReportingTask<B> {
|
||||
type Item = ();
|
||||
type Error = ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user