mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Switch the network timers to new futures (#3117)
This commit is contained in:
committed by
DemiMarie-parity
parent
991e9ae263
commit
1e77717b26
@@ -17,7 +17,8 @@
|
||||
use client::{backend::Backend, blockchain::HeaderBackend};
|
||||
use crate::config::Roles;
|
||||
use consensus::BlockOrigin;
|
||||
use std::{time::Duration, time::Instant};
|
||||
use futures03::TryFutureExt as _;
|
||||
use std::time::Duration;
|
||||
use tokio::runtime::current_thread;
|
||||
use super::*;
|
||||
|
||||
@@ -398,7 +399,7 @@ fn blocks_are_not_announced_by_light_nodes() {
|
||||
net.peers.remove(0);
|
||||
|
||||
// Poll for a few seconds and make sure 1 and 2 (now 0 and 1) don't sync together.
|
||||
let mut delay = tokio_timer::Delay::new(Instant::now() + Duration::from_secs(5));
|
||||
let mut delay = futures_timer::Delay::new(Duration::from_secs(5)).compat();
|
||||
runtime.block_on(futures::future::poll_fn::<(), (), _>(|| {
|
||||
net.poll();
|
||||
delay.poll().map_err(|_| ())
|
||||
@@ -486,7 +487,7 @@ fn can_not_sync_from_light_peer() {
|
||||
net.peers.remove(0);
|
||||
|
||||
// ensure that the #2 (now #1) fails to sync block #1 even after 5 seconds
|
||||
let mut test_finished = tokio_timer::Delay::new(Instant::now() + Duration::from_secs(5));
|
||||
let mut test_finished = futures_timer::Delay::new(Duration::from_secs(5)).compat();
|
||||
runtime.block_on(futures::future::poll_fn::<(), (), _>(|| -> Result<_, ()> {
|
||||
net.poll();
|
||||
test_finished.poll().map_err(|_| ())
|
||||
|
||||
Reference in New Issue
Block a user