Switch consensus crates to new futures (#3146)

* Switch consensus-common to new futures

* Fix tests

* More tests fixing

* Fix Babe tests

* Fix Babe tests
This commit is contained in:
Pierre Krieger
2019-07-25 04:55:50 +02:00
committed by Gavin Wood
parent 3a6a309d84
commit b31dcdf342
21 changed files with 208 additions and 184 deletions
+7 -3
View File
@@ -31,6 +31,7 @@ use std::sync::{Arc, atomic::{AtomicBool, AtomicUsize, Ordering}};
use consensus::import_queue::{ImportQueue, Link};
use consensus::import_queue::{BlockImportResult, BlockImportError};
use futures::{prelude::*, sync::mpsc};
use futures03::TryFutureExt as _;
use log::{warn, error, info};
use libp2p::{PeerId, Multiaddr, multihash::Multihash};
use libp2p::core::{transport::boxed::Boxed, muxing::StreamMuxerBox};
@@ -583,9 +584,12 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> Future for Ne
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
// Poll the import queue for actions to perform.
self.import_queue.poll_actions(&mut NetworkLink {
protocol: &mut self.network_service,
});
let _ = futures03::future::poll_fn(|cx| {
self.import_queue.poll_actions(cx, &mut NetworkLink {
protocol: &mut self.network_service,
});
std::task::Poll::Pending::<Result<(), ()>>
}).compat().poll();
// Check for new incoming on-demand requests.
if let Some(on_demand_in) = self.on_demand_in.as_mut() {