mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 05:37:58 +00:00
Switch offchain workers to new futures (#3285)
* Switch offchain workers to new futures * Fix tests
This commit is contained in:
committed by
Gavin Wood
parent
b29277239a
commit
3d65753d48
@@ -36,7 +36,7 @@ use crate::config::Configuration;
|
||||
use primitives::{Blake2Hasher, H256, traits::BareCryptoStorePtr};
|
||||
use rpc::{self, apis::system::SystemInfo};
|
||||
use futures::{prelude::*, future::Executor};
|
||||
use futures03::channel::mpsc;
|
||||
use futures03::{FutureExt as _, channel::mpsc, compat::Compat};
|
||||
|
||||
// Type aliases.
|
||||
// These exist mainly to avoid typing `<F as Factory>::Foo` all over the code.
|
||||
@@ -279,7 +279,9 @@ impl<C: Components> OffchainWorker<Self> for C where
|
||||
pool: &Arc<TransactionPool<C::TransactionPoolApi>>,
|
||||
network_state: &Arc<dyn NetworkStateInfo + Send + Sync>,
|
||||
) -> error::Result<Box<dyn Future<Item = (), Error = ()> + Send>> {
|
||||
Ok(Box::new(offchain.on_block_imported(number, pool, network_state.clone())))
|
||||
let future = offchain.on_block_imported(number, pool, network_state.clone())
|
||||
.map(|()| Ok(()));
|
||||
Ok(Box::new(Compat::new(future)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user