mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-05 10:29:32 +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-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 }
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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?),
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue