Skip to content

Commit

Permalink
fix unused warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg committed Feb 13, 2025
1 parent f4faa2e commit 2cf84e3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
14 changes: 8 additions & 6 deletions zebra-rpc/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
//! Some parts of the `zcashd` RPC documentation are outdated.
//! So this implementation follows the `zcashd` server and `lightwalletd` client implementations.
use std::{
collections::{HashMap, HashSet},
fmt::Debug,
sync::Arc,
};
#[cfg(feature = "getblocktemplate-rpcs")]
use std::collections::HashMap;
use std::{collections::HashSet, fmt::Debug, sync::Arc};

use chrono::Utc;
use futures::{stream::FuturesOrdered, StreamExt, TryFutureExt};
Expand All @@ -24,7 +22,6 @@ use tokio::{sync::broadcast, task::JoinHandle};
use tower::{Service, ServiceExt};
use tracing::Instrument;

use types::{GetRawMempool, MempoolObject};
use zcash_primitives::consensus::Parameters;
use zebra_chain::{
block::{self, Commitment, Height, SerializedBlock},
Expand Down Expand Up @@ -61,6 +58,10 @@ pub mod trees;

pub mod types;

use types::GetRawMempool;
#[cfg(feature = "getblocktemplate-rpcs")]
use types::MempoolObject;

#[cfg(feature = "getblocktemplate-rpcs")]
pub mod get_block_template_rpcs;

Expand Down Expand Up @@ -1073,6 +1074,7 @@ where
}

async fn get_raw_mempool(&self, verbose: Option<bool>) -> Result<GetRawMempool> {
#[allow(unused)]
let verbose = verbose.unwrap_or(false);

#[cfg(feature = "getblocktemplate-rpcs")]
Expand Down
18 changes: 9 additions & 9 deletions zebra-rpc/src/methods/tests/prop.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//! Randomised property tests for RPC methods.
use std::{
collections::{HashMap, HashSet},
fmt::Debug,
sync::Arc,
};
#[cfg(feature = "getblocktemplate-rpcs")]
use std::collections::HashMap;
use std::{collections::HashSet, fmt::Debug, sync::Arc};

use futures::{join, FutureExt, TryFutureExt};
use hex::{FromHex, ToHex};
Expand All @@ -31,9 +29,11 @@ use zebra_state::{BoxError, GetBlockTemplateChainInfo};

use zebra_test::mock_service::MockService;

#[cfg(feature = "getblocktemplate-rpcs")]
use crate::methods::types::MempoolObject;
use crate::methods::{
self,
types::{Balance, MempoolObject},
types::{Balance, GetRawMempool},
};

use super::super::{
Expand Down Expand Up @@ -262,7 +262,7 @@ proptest! {
.expect_request(mempool::Request::TransactionIds)
.map_ok(|r|r.respond(mempool::Response::TransactionIds(transaction_ids)));

(expected_response, mempool_query)
(GetRawMempool::TxIds(expected_response), mempool_query)
};

// Note: this depends on `SHOULD_USE_ZCASHD_ORDER` being true.
Expand Down Expand Up @@ -301,9 +301,9 @@ proptest! {
)
})
.collect::<HashMap<_, _>>();
methods::types::GetRawMempool::Verbose(map)
GetRawMempool::Verbose(map)
} else {
methods::types::GetRawMempool::TxIds(expected_response)
GetRawMempool::TxIds(expected_response)
};

let mempool_query = mempool
Expand Down
11 changes: 9 additions & 2 deletions zebra-rpc/src/methods/types/get_raw_mempool.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
use std::collections::{HashMap, HashSet};
use std::collections::HashMap;
#[cfg(feature = "getblocktemplate-rpcs")]
use std::collections::HashSet;

#[cfg(feature = "getblocktemplate-rpcs")]
use hex::ToHex as _;

use super::Zec;
use zebra_chain::{amount::NonNegative, block::Height, transaction::VerifiedUnminedTx};
#[cfg(feature = "getblocktemplate-rpcs")]
use zebra_chain::transaction::VerifiedUnminedTx;
use zebra_chain::{amount::NonNegative, block::Height};
#[cfg(feature = "getblocktemplate-rpcs")]
use zebra_node_services::mempool::TransactionDependencies;

/// Response to a `getrawmempool` RPC request.
Expand Down Expand Up @@ -47,6 +53,7 @@ pub struct MempoolObject {
}

impl MempoolObject {
#[cfg(feature = "getblocktemplate-rpcs")]
pub(crate) fn from_verified_unmined_tx(
unmined_tx: &VerifiedUnminedTx,
transactions: &[VerifiedUnminedTx],
Expand Down

0 comments on commit 2cf84e3

Please sign in to comment.