mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 15:35:42 +00:00
client/finality-grandpa: Make round_communication use bounded channel (#4691)
* clinet/finality-grandpa: Make round_communication use bounded channel `round_communication` returns a `Sink` and a `Stream` for outgoing and incoming messages. The messages send into the `Sink` are forwarded down to the network as well as send back into the `Stream` to ensure the node processes its own messages. So far, to send messages into the `Sink` back into the `Stream`, an unbounded channel was used. This patch updates `round_communication` and `OutgoingMessages` to use a bounded channel. This is part of a greater effort to reduce the number of owners of components within `finality-grandpa` and `network` as well as to reduce the amount of unbounded channels. For details seed9837d7ddand5f80929dc. * client/finality-grandpa: Import futures03::future::ready at the top * client/finality-grandpa: Make tests use compat of future 03 * client/finality-grandpa: Do not import ready into scope Instead of importing futures03::future::ready into the scope, only import futures::future03 into scope and call ready as furure03::ready.
This commit is contained in:
committed by
Robert Habermeier
parent
4b2e6a5be2
commit
597c0a6c4f
@@ -22,7 +22,11 @@ use std::time::Duration;
|
||||
use log::{debug, warn, info};
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use futures::prelude::*;
|
||||
use futures03::future::{FutureExt as _, TryFutureExt as _};
|
||||
use futures03::{
|
||||
compat::{Compat, CompatSink},
|
||||
future::{FutureExt as _, TryFutureExt as _},
|
||||
stream::StreamExt as _,
|
||||
};
|
||||
use futures_timer::Delay;
|
||||
use parking_lot::RwLock;
|
||||
use sp_blockchain::{HeaderBackend, Error as ClientError};
|
||||
@@ -608,6 +612,9 @@ where
|
||||
has_voted,
|
||||
);
|
||||
|
||||
let incoming = Compat::new(incoming.map(|item| Ok::<_, Error>(item)));
|
||||
let outgoing = CompatSink::new(outgoing);
|
||||
|
||||
// schedule incoming messages from the network to be held until
|
||||
// corresponding blocks are imported.
|
||||
let incoming = Box::new(UntilVoteTargetImported::new(
|
||||
|
||||
Reference in New Issue
Block a user