This commit is contained in:
hinto.janai 2024-11-26 19:37:35 -05:00
parent 1ffa86c5ae
commit 916d593024
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
6 changed files with 4 additions and 8 deletions

View file

@ -31,7 +31,7 @@ cuprate-txpool = { workspace = true }
cuprate-database = { workspace = true } cuprate-database = { workspace = true }
cuprate-pruning = { workspace = true } cuprate-pruning = { workspace = true }
cuprate-test-utils = { workspace = true } cuprate-test-utils = { workspace = true }
cuprate-types = { workspace = true } cuprate-types = { workspace = true, features = ["json"] }
cuprate-json-rpc = { workspace = true } cuprate-json-rpc = { workspace = true }
cuprate-rpc-interface = { workspace = true } cuprate-rpc-interface = { workspace = true }
cuprate-rpc-types = { workspace = true } cuprate-rpc-types = { workspace = true }

View file

@ -140,7 +140,7 @@ pub type BlockchainManagerHandle = cuprate_database_service::DatabaseReadService
/// TODO /// TODO
#[derive(Clone)] #[derive(Clone)]
pub struct CupratedRpcHandler { 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`]. /// This is not `pub` on purpose, as it should not be mutated after [`Self::new`].
restricted: bool, restricted: bool,

View file

@ -164,7 +164,7 @@ pub(super) fn hex_to_hash(hex: String) -> Result<[u8; 32], Error> {
Ok(hash) 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> { 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 (chain_height, hash) = blockchain::chain_height(&mut state.blockchain_read).await?;
let height = chain_height.saturating_sub(1); let height = chain_height.saturating_sub(1);

View file

@ -117,9 +117,6 @@ pub(super) async fn map_request(
Req::GetTransactionPoolBacklog(r) => { Req::GetTransactionPoolBacklog(r) => {
Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r).await?) 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::GetMinerData(r) => Resp::GetMinerData(get_miner_data(state, r).await?),
Req::PruneBlockchain(r) => Resp::PruneBlockchain(prune_blockchain(state, r).await?), Req::PruneBlockchain(r) => Resp::PruneBlockchain(prune_blockchain(state, r).await?),
Req::CalcPow(r) => Resp::CalcPow(calc_pow(state, r).await?), Req::CalcPow(r) => Resp::CalcPow(calc_pow(state, r).await?),

View file

@ -59,7 +59,7 @@ The error type must always be [`anyhow::Error`].
The `RpcHandler` must also hold some state that is required The `RpcHandler` must also hold some state that is required
for RPC server operation. 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. server is restricted or not, and thus, if some endpoints/methods are allowed or not.
# Unknown endpoint behavior # Unknown endpoint behavior

View file

@ -1755,7 +1755,6 @@ pub enum JsonRpcResponse {
RelayTx(RelayTxResponse), RelayTx(RelayTxResponse),
SyncInfo(SyncInfoResponse), SyncInfo(SyncInfoResponse),
GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse), GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse),
GetOutputDistribution(GetOutputDistributionResponse),
GetMinerData(GetMinerDataResponse), GetMinerData(GetMinerDataResponse),
PruneBlockchain(PruneBlockchainResponse), PruneBlockchain(PruneBlockchainResponse),
CalcPow(CalcPowResponse), CalcPow(CalcPowResponse),