Skip to content

Commit

Permalink
Merge pull request #79 from CherryNetwork/dev
Browse files Browse the repository at this point in the history
cargo fmt
  • Loading branch information
charmitro committed Apr 21, 2022
2 parents e728154 + 6b8975c commit c2d29b6
Show file tree
Hide file tree
Showing 3 changed files with 582 additions and 602 deletions.
19 changes: 8 additions & 11 deletions client/offchain/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ pub use http::SharedClient;
use sc_network::{Multiaddr, PeerId};
use sp_core::{
offchain::{
self, HttpError, HttpRequestId, HttpRequestStatus, OffchainStorage, OpaqueMultiaddr,
OpaqueNetworkState, StorageKind, Timestamp, IpfsRequest, IpfsRequestId, IpfsRequestStatus,
self, HttpError, HttpRequestId, HttpRequestStatus, IpfsRequest, IpfsRequestId,
IpfsRequestStatus, OffchainStorage, OpaqueMultiaddr, OpaqueNetworkState, StorageKind,
Timestamp,
},
OpaquePeerId,
};
Expand All @@ -35,11 +36,6 @@ mod http;

mod ipfs;

#[cfg(target_os = "unknown")]
use http_dummy as http;
#[cfg(target_os = "unknown")]
mod http_dummy;

mod timestamp;

fn unavailable_yet<R: Default>(name: &str) -> R {
Expand Down Expand Up @@ -234,7 +230,7 @@ impl offchain::Externalities for Api {
fn ipfs_response_wait(
&mut self,
ids: &[IpfsRequestId],
deadline: Option<Timestamp>
deadline: Option<Timestamp>,
) -> Vec<IpfsRequestStatus> {
self.ipfs.response_wait(ids, deadline)
}
Expand Down Expand Up @@ -314,13 +310,13 @@ pub(crate) struct AsyncApi<I: ::ipfs::IpfsTypes> {
ipfs: Option<ipfs::IpfsWorker<I>>,
}

impl <I: ::ipfs::IpfsTypes> AsyncApi<I> {
impl<I: ::ipfs::IpfsTypes> AsyncApi<I> {
/// Creates new Offchain extensions API implementation an the asynchronous processing part.
pub fn new(
network_provider: Arc<dyn NetworkProvider + Send + Sync>,
is_validator: bool,
shared_client: SharedClient,
ipfs_node: ::ipfs::Ipfs<I>
ipfs_node: ::ipfs::Ipfs<I>,
) -> (Api, Self) {
let (http_api, http_worker) = http::http(shared_client);

Expand Down Expand Up @@ -382,7 +378,8 @@ mod tests {
let options = ::ipfs::IpfsOptions::default();
let mut rt = tokio::runtime::Runtime::new().unwrap();
let ipfs_node = rt.block_on(async move {
let (ipfs, fut) = ::ipfs::UninitializedIpfs::new(options, None).await.start().await.unwrap();
let (ipfs, fut) =
::ipfs::UninitializedIpfs::new(options, None).await.start().await.unwrap();
tokio::task::spawn(fut);
ipfs
});
Expand Down
Loading

0 comments on commit c2d29b6

Please sign in to comment.