Sfoglia il codice sorgente

blockchain/monero: Fix featured imports

parazyd 1 anno fa
parent
commit
f2a6448ff7
2 ha cambiato i file con 10 aggiunte e 6 eliminazioni
  1. 5 3
      src/blockchain/monero/merkle_proof.rs
  2. 5 3
      src/blockchain/monero/mod.rs

+ 5 - 3
src/blockchain/monero/merkle_proof.rs

@@ -18,11 +18,11 @@
 
 use std::io::{self, Cursor, Error, Read, Write};
 
-use async_trait::async_trait;
+#[cfg(feature = "async-serial")]
 use darkfi_serial::{
-    AsyncDecodable, AsyncEncodable, AsyncRead, AsyncReadExt, AsyncWrite, Decodable, Encodable,
-    ReadExt,
+    async_trait, AsyncDecodable, AsyncEncodable, AsyncRead, AsyncReadExt, AsyncWrite,
 };
+use darkfi_serial::{Decodable, Encodable, ReadExt};
 use monero::{
     consensus::{Decodable as XmrDecodable, Encodable as XmrEncodable},
     Hash,
@@ -56,6 +56,7 @@ impl Encodable for MerkleProof {
     }
 }
 
+#[cfg(feature = "async-serial")]
 #[async_trait]
 impl AsyncEncodable for MerkleProof {
     async fn encode_async<S: AsyncWrite + Unpin + Send>(&self, s: &mut S) -> io::Result<usize> {
@@ -91,6 +92,7 @@ impl Decodable for MerkleProof {
     }
 }
 
+#[cfg(feature = "async-serial")]
 #[async_trait]
 impl AsyncDecodable for MerkleProof {
     async fn decode_async<D: AsyncRead + Unpin + Send>(d: &mut D) -> io::Result<Self> {

+ 5 - 3
src/blockchain/monero/mod.rs

@@ -18,8 +18,9 @@
 
 use std::io::{self, Cursor, Error, Read, Write};
 
-use async_trait::async_trait;
-use darkfi_serial::{AsyncDecodable, AsyncEncodable, AsyncRead, AsyncWrite, Decodable, Encodable};
+#[cfg(feature = "async-serial")]
+use darkfi_serial::{async_trait, AsyncDecodable, AsyncEncodable, AsyncRead, AsyncWrite};
+use darkfi_serial::{Decodable, Encodable};
 use monero::{
     blockdata::transaction::RawExtraField,
     consensus::{Decodable as XmrDecodable, Encodable as XmrEncodable},
@@ -83,6 +84,7 @@ impl Encodable for MoneroPowData {
     }
 }
 
+#[cfg(feature = "async-serial")]
 #[async_trait]
 impl AsyncEncodable for MoneroPowData {
     async fn encode_async<S: AsyncWrite + Unpin + Send>(&self, s: &mut S) -> io::Result<usize> {
@@ -113,7 +115,6 @@ impl AsyncEncodable for MoneroPowData {
     }
 }
 
-#[async_trait]
 impl Decodable for MoneroPowData {
     fn decode<D: Read>(d: &mut D) -> io::Result<Self> {
         let header =
@@ -147,6 +148,7 @@ impl Decodable for MoneroPowData {
     }
 }
 
+#[cfg(feature = "async-serial")]
 #[async_trait]
 impl AsyncDecodable for MoneroPowData {
     async fn decode_async<D: AsyncRead + Unpin + Send>(d: &mut D) -> io::Result<Self> {