From 916d593024574d5ce85c8fdb7ee8097f5ad7fe09 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Tue, 26 Nov 2024 19:37:35 -0500 Subject: [PATCH] fixes --- binaries/cuprated/Cargo.toml | 2 +- binaries/cuprated/src/rpc/handler.rs | 2 +- binaries/cuprated/src/rpc/helper.rs | 2 +- binaries/cuprated/src/rpc/json.rs | 3 --- rpc/interface/README.md | 2 +- rpc/types/src/json.rs | 1 - 6 files changed, 4 insertions(+), 8 deletions(-) diff --git a/binaries/cuprated/Cargo.toml b/binaries/cuprated/Cargo.toml index b2700681..343a6ec0 100644 --- a/binaries/cuprated/Cargo.toml +++ b/binaries/cuprated/Cargo.toml @@ -31,7 +31,7 @@ cuprate-txpool = { workspace = true } cuprate-database = { workspace = true } cuprate-pruning = { workspace = true } cuprate-test-utils = { workspace = true } -cuprate-types = { workspace = true } +cuprate-types = { workspace = true, features = ["json"] } cuprate-json-rpc = { workspace = true } cuprate-rpc-interface = { workspace = true } cuprate-rpc-types = { workspace = true } diff --git a/binaries/cuprated/src/rpc/handler.rs b/binaries/cuprated/src/rpc/handler.rs index f3eb8314..3d2ee0f7 100644 --- a/binaries/cuprated/src/rpc/handler.rs +++ b/binaries/cuprated/src/rpc/handler.rs @@ -140,7 +140,7 @@ pub type BlockchainManagerHandle = cuprate_database_service::DatabaseReadService /// TODO #[derive(Clone)] pub struct CupratedRpcHandler { - /// Should this RPC server be [restricted](RpcHandler::restricted)? + /// Should this RPC server be [restricted](RpcHandler::is_restricted)? /// /// This is not `pub` on purpose, as it should not be mutated after [`Self::new`]. restricted: bool, diff --git a/binaries/cuprated/src/rpc/helper.rs b/binaries/cuprated/src/rpc/helper.rs index e12c20a7..31e2171c 100644 --- a/binaries/cuprated/src/rpc/helper.rs +++ b/binaries/cuprated/src/rpc/helper.rs @@ -164,7 +164,7 @@ pub(super) fn hex_to_hash(hex: String) -> Result<[u8; 32], Error> { Ok(hash) } -/// [`BlockchainResponse::ChainHeight`] minus 1. +/// [`cuprate_types::blockchain::BlockchainResponse::ChainHeight`] minus 1. pub(super) async fn top_height(state: &mut CupratedRpcHandler) -> Result<(u64, [u8; 32]), Error> { let (chain_height, hash) = blockchain::chain_height(&mut state.blockchain_read).await?; let height = chain_height.saturating_sub(1); diff --git a/binaries/cuprated/src/rpc/json.rs b/binaries/cuprated/src/rpc/json.rs index 272c42b2..134e05a5 100644 --- a/binaries/cuprated/src/rpc/json.rs +++ b/binaries/cuprated/src/rpc/json.rs @@ -117,9 +117,6 @@ pub(super) async fn map_request( Req::GetTransactionPoolBacklog(r) => { Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r).await?) } - Req::GetOutputDistribution(r) => { - Resp::GetOutputDistribution(get_output_distribution(state, r).await?) - } Req::GetMinerData(r) => Resp::GetMinerData(get_miner_data(state, r).await?), Req::PruneBlockchain(r) => Resp::PruneBlockchain(prune_blockchain(state, r).await?), Req::CalcPow(r) => Resp::CalcPow(calc_pow(state, r).await?), diff --git a/rpc/interface/README.md b/rpc/interface/README.md index fa5496c1..9bcb416f 100644 --- a/rpc/interface/README.md +++ b/rpc/interface/README.md @@ -59,7 +59,7 @@ The error type must always be [`anyhow::Error`]. The `RpcHandler` must also hold some state that is required for RPC server operation. -The only state currently needed is [`RpcHandler::restricted`], which determines if an RPC +The only state currently needed is [`RpcHandler::is_restricted`], which determines if an RPC server is restricted or not, and thus, if some endpoints/methods are allowed or not. # Unknown endpoint behavior diff --git a/rpc/types/src/json.rs b/rpc/types/src/json.rs index 46b9c38b..cb55e64a 100644 --- a/rpc/types/src/json.rs +++ b/rpc/types/src/json.rs @@ -1755,7 +1755,6 @@ pub enum JsonRpcResponse { RelayTx(RelayTxResponse), SyncInfo(SyncInfoResponse), GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse), - GetOutputDistribution(GetOutputDistributionResponse), GetMinerData(GetMinerDataResponse), PruneBlockchain(PruneBlockchainResponse), CalcPow(CalcPowResponse),