mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-23 03:59:31 +00:00
fixes
This commit is contained in:
parent
1ffa86c5ae
commit
916d593024
6 changed files with 4 additions and 8 deletions
|
@ -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 }
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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?),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1755,7 +1755,6 @@ pub enum JsonRpcResponse {
|
|||
RelayTx(RelayTxResponse),
|
||||
SyncInfo(SyncInfoResponse),
|
||||
GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse),
|
||||
GetOutputDistribution(GetOutputDistributionResponse),
|
||||
GetMinerData(GetMinerDataResponse),
|
||||
PruneBlockchain(PruneBlockchainResponse),
|
||||
CalcPow(CalcPowResponse),
|
||||
|
|
Loading…
Reference in a new issue