use BoxFuture

This commit is contained in:
hinto.janai 2024-09-05 18:06:07 -04:00
parent 29afe237d5
commit 7406afb910
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
6 changed files with 169 additions and 145 deletions

View file

@ -4,6 +4,10 @@
unused_imports,
unreachable_pub,
unused_crate_dependencies,
dead_code,
unused_variables,
clippy::needless_pass_by_value,
clippy::unused_async,
reason = "TODO: remove after v1.0.0"
)]

View file

@ -3,7 +3,6 @@
//! Will contain the code to initiate the RPC and a request handler.
// TODO: remove after impl.
#![allow(dead_code, unused_variables, clippy::needless_pass_by_value)]
mod bin;
mod handler;

View file

@ -11,7 +11,8 @@ use cuprate_rpc_types::{
use crate::rpc::CupratedRpcHandler;
pub(super) fn map_request(
/// Map a [`BinRequest`] to the function that will lead to a [`BinResponse`].
pub(super) async fn map_request(
state: CupratedRpcHandler,
request: BinRequest,
) -> Result<BinResponse, RpcError> {
@ -19,63 +20,63 @@ pub(super) fn map_request(
use BinResponse as Resp;
Ok(match request {
Req::GetBlocks(r) => Resp::GetBlocks(get_blocks(state, r)?),
Req::GetBlocksByHeight(r) => Resp::GetBlocksByHeight(get_blocks_by_height(state, r)?),
Req::GetHashes(r) => Resp::GetHashes(get_hashes(state, r)?),
Req::GetOutputIndexes(r) => Resp::GetOutputIndexes(get_output_indexes(state, r)?),
Req::GetOuts(r) => Resp::GetOuts(get_outs(state, r)?),
Req::GetBlocks(r) => Resp::GetBlocks(get_blocks(state, r).await?),
Req::GetBlocksByHeight(r) => Resp::GetBlocksByHeight(get_blocks_by_height(state, r).await?),
Req::GetHashes(r) => Resp::GetHashes(get_hashes(state, r).await?),
Req::GetOutputIndexes(r) => Resp::GetOutputIndexes(get_output_indexes(state, r).await?),
Req::GetOuts(r) => Resp::GetOuts(get_outs(state, r).await?),
Req::GetTransactionPoolHashes(r) => {
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r)?)
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r).await?)
}
Req::GetOutputDistribution(r) => {
Resp::GetOutputDistribution(get_output_distribution(state, r)?)
Resp::GetOutputDistribution(get_output_distribution(state, r).await?)
}
})
}
fn get_blocks(
async fn get_blocks(
state: CupratedRpcHandler,
request: GetBlocksRequest,
) -> Result<GetBlocksResponse, RpcError> {
todo!()
}
fn get_blocks_by_height(
async fn get_blocks_by_height(
state: CupratedRpcHandler,
request: GetBlocksByHeightRequest,
) -> Result<GetBlocksByHeightResponse, RpcError> {
todo!()
}
fn get_hashes(
async fn get_hashes(
state: CupratedRpcHandler,
request: GetHashesRequest,
) -> Result<GetHashesResponse, RpcError> {
todo!()
}
fn get_output_indexes(
async fn get_output_indexes(
state: CupratedRpcHandler,
request: GetOutputIndexesRequest,
) -> Result<GetOutputIndexesResponse, RpcError> {
todo!()
}
fn get_outs(
async fn get_outs(
state: CupratedRpcHandler,
request: GetOutsRequest,
) -> Result<GetOutsResponse, RpcError> {
todo!()
}
fn get_transaction_pool_hashes(
async fn get_transaction_pool_hashes(
state: CupratedRpcHandler,
request: GetTransactionPoolHashesRequest,
) -> Result<GetTransactionPoolHashesResponse, RpcError> {
todo!()
}
fn get_output_distribution(
async fn get_output_distribution(
state: CupratedRpcHandler,
request: GetOutputDistributionRequest,
) -> Result<GetOutputDistributionResponse, RpcError> {

View file

@ -1,6 +1,5 @@
//! Dummy implementation of [`RpcHandler`].
//---------------------------------------------------------------------------------------------------- Use
use std::task::Poll;
use cuprate_rpc_types::{
@ -8,7 +7,7 @@ use cuprate_rpc_types::{
json::{JsonRpcRequest, JsonRpcResponse},
other::{OtherRequest, OtherResponse},
};
use futures::channel::oneshot::channel;
use futures::{channel::oneshot::channel, future::BoxFuture};
use serde::{Deserialize, Serialize};
use tower::Service;
@ -20,7 +19,6 @@ use cuprate_txpool::service::TxpoolReadHandle;
use crate::rpc::{bin, json, other};
//---------------------------------------------------------------------------------------------------- CupratedRpcHandler
/// TODO
#[derive(Clone)]
pub struct CupratedRpcHandler {
@ -34,7 +32,6 @@ pub struct CupratedRpcHandler {
pub txpool: TxpoolReadHandle,
}
//---------------------------------------------------------------------------------------------------- RpcHandler Impl
impl RpcHandler for CupratedRpcHandler {
fn restricted(&self) -> bool {
self.restricted
@ -51,7 +48,7 @@ impl RpcHandler for CupratedRpcHandler {
impl Service<JsonRpcRequest> for CupratedRpcHandler {
type Response = JsonRpcResponse;
type Error = RpcError;
type Future = InfallibleOneshotReceiver<Result<JsonRpcResponse, RpcError>>;
type Future = BoxFuture<'static, Result<JsonRpcResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
@ -59,15 +56,14 @@ impl Service<JsonRpcRequest> for CupratedRpcHandler {
fn call(&mut self, request: JsonRpcRequest) -> Self::Future {
let state = Self::clone(self);
let response = json::map_request(state, request).expect("TODO");
todo!()
Box::pin(json::map_request(state, request))
}
}
impl Service<BinRequest> for CupratedRpcHandler {
type Response = BinResponse;
type Error = RpcError;
type Future = InfallibleOneshotReceiver<Result<BinResponse, RpcError>>;
type Future = BoxFuture<'static, Result<BinResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
@ -75,15 +71,14 @@ impl Service<BinRequest> for CupratedRpcHandler {
fn call(&mut self, request: BinRequest) -> Self::Future {
let state = Self::clone(self);
let response = bin::map_request(state, request).expect("TODO");
todo!()
Box::pin(bin::map_request(state, request))
}
}
impl Service<OtherRequest> for CupratedRpcHandler {
type Response = OtherResponse;
type Error = RpcError;
type Future = InfallibleOneshotReceiver<Result<OtherResponse, RpcError>>;
type Future = BoxFuture<'static, Result<OtherResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
@ -91,7 +86,6 @@ impl Service<OtherRequest> for CupratedRpcHandler {
fn call(&mut self, request: OtherRequest) -> Self::Future {
let state = Self::clone(self);
let response = other::map_request(state, request).expect("TODO");
todo!()
Box::pin(other::map_request(state, request))
}
}

View file

@ -20,10 +20,12 @@ use cuprate_rpc_types::json::{
RelayTxResponse, SetBansRequest, SetBansResponse, SubmitBlockRequest, SubmitBlockResponse,
SyncInfoRequest, SyncInfoResponse,
};
use tower::ServiceExt;
use crate::rpc::CupratedRpcHandler;
pub(super) fn map_request(
/// Map a [`JsonRpcRequest`] to the function that will lead to a [`JsonRpcResponse`].
pub(super) async fn map_request(
state: CupratedRpcHandler,
request: JsonRpcRequest,
) -> Result<JsonRpcResponse, RpcError> {
@ -31,250 +33,259 @@ pub(super) fn map_request(
use JsonRpcResponse as Resp;
Ok(match request {
Req::GetBlockCount(r) => Resp::GetBlockCount(get_block_count(state, r)?),
Req::OnGetBlockHash(r) => Resp::OnGetBlockHash(on_get_block_hash(state, r)?),
Req::SubmitBlock(r) => Resp::SubmitBlock(submit_block(state, r)?),
Req::GenerateBlocks(r) => Resp::GenerateBlocks(generate_blocks(state, r)?),
Req::GetLastBlockHeader(r) => Resp::GetLastBlockHeader(get_last_block_header(state, r)?),
Req::GetBlockCount(r) => Resp::GetBlockCount(get_block_count(state, r).await?),
Req::OnGetBlockHash(r) => Resp::OnGetBlockHash(on_get_block_hash(state, r).await?),
Req::SubmitBlock(r) => Resp::SubmitBlock(submit_block(state, r).await?),
Req::GenerateBlocks(r) => Resp::GenerateBlocks(generate_blocks(state, r).await?),
Req::GetLastBlockHeader(r) => {
Resp::GetLastBlockHeader(get_last_block_header(state, r).await?)
}
Req::GetBlockHeaderByHash(r) => {
Resp::GetBlockHeaderByHash(get_block_header_by_hash(state, r)?)
Resp::GetBlockHeaderByHash(get_block_header_by_hash(state, r).await?)
}
Req::GetBlockHeaderByHeight(r) => {
Resp::GetBlockHeaderByHeight(get_block_header_by_height(state, r)?)
Resp::GetBlockHeaderByHeight(get_block_header_by_height(state, r).await?)
}
Req::GetBlockHeadersRange(r) => {
Resp::GetBlockHeadersRange(get_block_headers_range(state, r)?)
Resp::GetBlockHeadersRange(get_block_headers_range(state, r).await?)
}
Req::GetBlock(r) => Resp::GetBlock(get_block(state, r)?),
Req::GetConnections(r) => Resp::GetConnections(get_connections(state, r)?),
Req::GetInfo(r) => Resp::GetInfo(get_info(state, r)?),
Req::HardForkInfo(r) => Resp::HardForkInfo(hard_fork_info(state, r)?),
Req::SetBans(r) => Resp::SetBans(set_bans(state, r)?),
Req::GetBans(r) => Resp::GetBans(get_bans(state, r)?),
Req::Banned(r) => Resp::Banned(banned(state, r)?),
Req::GetBlock(r) => Resp::GetBlock(get_block(state, r).await?),
Req::GetConnections(r) => Resp::GetConnections(get_connections(state, r).await?),
Req::GetInfo(r) => Resp::GetInfo(get_info(state, r).await?),
Req::HardForkInfo(r) => Resp::HardForkInfo(hard_fork_info(state, r).await?),
Req::SetBans(r) => Resp::SetBans(set_bans(state, r).await?),
Req::GetBans(r) => Resp::GetBans(get_bans(state, r).await?),
Req::Banned(r) => Resp::Banned(banned(state, r).await?),
Req::FlushTransactionPool(r) => {
Resp::FlushTransactionPool(flush_transaction_pool(state, r)?)
Resp::FlushTransactionPool(flush_transaction_pool(state, r).await?)
}
Req::GetOutputHistogram(r) => Resp::GetOutputHistogram(get_output_histogram(state, r)?),
Req::GetCoinbaseTxSum(r) => Resp::GetCoinbaseTxSum(get_coinbase_tx_sum(state, r)?),
Req::GetVersion(r) => Resp::GetVersion(get_version(state, r)?),
Req::GetFeeEstimate(r) => Resp::GetFeeEstimate(get_fee_estimate(state, r)?),
Req::GetAlternateChains(r) => Resp::GetAlternateChains(get_alternate_chains(state, r)?),
Req::RelayTx(r) => Resp::RelayTx(relay_tx(state, r)?),
Req::SyncInfo(r) => Resp::SyncInfo(sync_info(state, r)?),
Req::GetOutputHistogram(r) => {
Resp::GetOutputHistogram(get_output_histogram(state, r).await?)
}
Req::GetCoinbaseTxSum(r) => Resp::GetCoinbaseTxSum(get_coinbase_tx_sum(state, r).await?),
Req::GetVersion(r) => Resp::GetVersion(get_version(state, r).await?),
Req::GetFeeEstimate(r) => Resp::GetFeeEstimate(get_fee_estimate(state, r).await?),
Req::GetAlternateChains(r) => {
Resp::GetAlternateChains(get_alternate_chains(state, r).await?)
}
Req::RelayTx(r) => Resp::RelayTx(relay_tx(state, r).await?),
Req::SyncInfo(r) => Resp::SyncInfo(sync_info(state, r).await?),
Req::GetTransactionPoolBacklog(r) => {
Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r)?)
Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r).await?)
}
Req::GetMinerData(r) => Resp::GetMinerData(get_miner_data(state, r)?),
Req::PruneBlockchain(r) => Resp::PruneBlockchain(prune_blockchain(state, r)?),
Req::CalcPow(r) => Resp::CalcPow(calc_pow(state, r)?),
Req::FlushCache(r) => Resp::FlushCache(flush_cache(state, r)?),
Req::AddAuxPow(r) => Resp::AddAuxPow(add_aux_pow(state, r)?),
Req::GetTxIdsLoose(r) => Resp::GetTxIdsLoose(get_tx_ids_loose(state, r)?),
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?),
Req::FlushCache(r) => Resp::FlushCache(flush_cache(state, r).await?),
Req::AddAuxPow(r) => Resp::AddAuxPow(add_aux_pow(state, r).await?),
Req::GetTxIdsLoose(r) => Resp::GetTxIdsLoose(get_tx_ids_loose(state, r).await?),
})
}
fn get_block_count(
async fn get_block_count(
state: CupratedRpcHandler,
request: GetBlockCountRequest,
) -> Result<GetBlockCountResponse, RpcError> {
todo!()
}
fn on_get_block_hash(
async fn on_get_block_hash(
state: CupratedRpcHandler,
request: OnGetBlockHashRequest,
) -> Result<OnGetBlockHashResponse, RpcError> {
todo!()
}
fn submit_block(
async fn submit_block(
state: CupratedRpcHandler,
request: SubmitBlockRequest,
) -> Result<SubmitBlockResponse, RpcError> {
todo!()
}
fn generate_blocks(
async fn generate_blocks(
state: CupratedRpcHandler,
request: GenerateBlocksRequest,
) -> Result<GenerateBlocksResponse, RpcError> {
todo!()
}
fn get_last_block_header(
async fn get_last_block_header(
state: CupratedRpcHandler,
request: GetLastBlockHeaderRequest,
) -> Result<GetLastBlockHeaderResponse, RpcError> {
todo!()
}
fn get_block_header_by_hash(
async fn get_block_header_by_hash(
state: CupratedRpcHandler,
request: GetBlockHeaderByHashRequest,
) -> Result<GetBlockHeaderByHashResponse, RpcError> {
todo!()
}
fn get_block_header_by_height(
async fn get_block_header_by_height(
state: CupratedRpcHandler,
request: GetBlockHeaderByHeightRequest,
) -> Result<GetBlockHeaderByHeightResponse, RpcError> {
todo!()
}
fn get_block_headers_range(
async fn get_block_headers_range(
state: CupratedRpcHandler,
request: GetBlockHeadersRangeRequest,
) -> Result<GetBlockHeadersRangeResponse, RpcError> {
todo!()
}
fn get_block(
async fn get_block(
state: CupratedRpcHandler,
request: GetBlockRequest,
) -> Result<GetBlockResponse, RpcError> {
todo!()
}
fn get_connections(
async fn get_connections(
state: CupratedRpcHandler,
request: GetConnectionsRequest,
) -> Result<GetConnectionsResponse, RpcError> {
todo!()
}
fn get_info(
async fn get_info(
state: CupratedRpcHandler,
request: GetInfoRequest,
) -> Result<GetInfoResponse, RpcError> {
todo!()
}
fn hard_fork_info(
async fn hard_fork_info(
state: CupratedRpcHandler,
request: HardForkInfoRequest,
) -> Result<HardForkInfoResponse, RpcError> {
todo!()
}
fn set_bans(
async fn set_bans(
state: CupratedRpcHandler,
request: SetBansRequest,
) -> Result<SetBansResponse, RpcError> {
todo!()
}
fn get_bans(
async fn get_bans(
state: CupratedRpcHandler,
request: GetBansRequest,
) -> Result<GetBansResponse, RpcError> {
todo!()
}
fn banned(state: CupratedRpcHandler, request: BannedRequest) -> Result<BannedResponse, RpcError> {
async fn banned(
state: CupratedRpcHandler,
request: BannedRequest,
) -> Result<BannedResponse, RpcError> {
todo!()
}
fn flush_transaction_pool(
async fn flush_transaction_pool(
state: CupratedRpcHandler,
request: FlushTransactionPoolRequest,
) -> Result<FlushTransactionPoolResponse, RpcError> {
todo!()
}
fn get_output_histogram(
async fn get_output_histogram(
state: CupratedRpcHandler,
request: GetOutputHistogramRequest,
) -> Result<GetOutputHistogramResponse, RpcError> {
todo!()
}
fn get_coinbase_tx_sum(
async fn get_coinbase_tx_sum(
state: CupratedRpcHandler,
request: GetCoinbaseTxSumRequest,
) -> Result<GetCoinbaseTxSumResponse, RpcError> {
todo!()
}
fn get_version(
async fn get_version(
state: CupratedRpcHandler,
request: GetVersionRequest,
) -> Result<GetVersionResponse, RpcError> {
todo!()
}
fn get_fee_estimate(
async fn get_fee_estimate(
state: CupratedRpcHandler,
request: GetFeeEstimateRequest,
) -> Result<GetFeeEstimateResponse, RpcError> {
todo!()
}
fn get_alternate_chains(
async fn get_alternate_chains(
state: CupratedRpcHandler,
request: GetAlternateChainsRequest,
) -> Result<GetAlternateChainsResponse, RpcError> {
todo!()
}
fn relay_tx(
async fn relay_tx(
state: CupratedRpcHandler,
request: RelayTxRequest,
) -> Result<RelayTxResponse, RpcError> {
todo!()
}
fn sync_info(
async fn sync_info(
state: CupratedRpcHandler,
request: SyncInfoRequest,
) -> Result<SyncInfoResponse, RpcError> {
todo!()
}
fn get_transaction_pool_backlog(
async fn get_transaction_pool_backlog(
state: CupratedRpcHandler,
request: GetTransactionPoolBacklogRequest,
) -> Result<GetTransactionPoolBacklogResponse, RpcError> {
todo!()
}
fn get_miner_data(
async fn get_miner_data(
state: CupratedRpcHandler,
request: GetMinerDataRequest,
) -> Result<GetMinerDataResponse, RpcError> {
todo!()
}
fn prune_blockchain(
async fn prune_blockchain(
state: CupratedRpcHandler,
request: PruneBlockchainRequest,
) -> Result<PruneBlockchainResponse, RpcError> {
todo!()
}
fn calc_pow(
async fn calc_pow(
state: CupratedRpcHandler,
request: CalcPowRequest,
) -> Result<CalcPowResponse, RpcError> {
todo!()
}
fn flush_cache(
async fn flush_cache(
state: CupratedRpcHandler,
request: FlushCacheRequest,
) -> Result<FlushCacheResponse, RpcError> {
todo!()
}
fn add_aux_pow(
async fn add_aux_pow(
state: CupratedRpcHandler,
request: AddAuxPowRequest,
) -> Result<AddAuxPowResponse, RpcError> {
todo!()
}
fn get_tx_ids_loose(
async fn get_tx_ids_loose(
state: CupratedRpcHandler,
request: GetTxIdsLooseRequest,
) -> Result<GetTxIdsLooseResponse, RpcError> {

View file

@ -18,7 +18,8 @@ use cuprate_rpc_types::other::{
use crate::rpc::CupratedRpcHandler;
pub(super) fn map_request(
/// Map a [`OtherRequest`] to the function that will lead to a [`OtherResponse`].
pub(super) async fn map_request(
state: CupratedRpcHandler,
request: OtherRequest,
) -> Result<OtherResponse, RpcError> {
@ -26,217 +27,231 @@ pub(super) fn map_request(
use OtherResponse as Resp;
Ok(match request {
Req::GetHeight(r) => Resp::GetHeight(get_height(state, r)?),
Req::GetTransactions(r) => Resp::GetTransactions(get_transactions(state, r)?),
Req::GetAltBlocksHashes(r) => Resp::GetAltBlocksHashes(get_alt_blocks_hashes(state, r)?),
Req::IsKeyImageSpent(r) => Resp::IsKeyImageSpent(is_key_image_spent(state, r)?),
Req::SendRawTransaction(r) => Resp::SendRawTransaction(send_raw_transaction(state, r)?),
Req::StartMining(r) => Resp::StartMining(start_mining(state, r)?),
Req::StopMining(r) => Resp::StopMining(stop_mining(state, r)?),
Req::MiningStatus(r) => Resp::MiningStatus(mining_status(state, r)?),
Req::SaveBc(r) => Resp::SaveBc(save_bc(state, r)?),
Req::GetPeerList(r) => Resp::GetPeerList(get_peer_list(state, r)?),
Req::SetLogHashRate(r) => Resp::SetLogHashRate(set_log_hash_rate(state, r)?),
Req::SetLogLevel(r) => Resp::SetLogLevel(set_log_level(state, r)?),
Req::SetLogCategories(r) => Resp::SetLogCategories(set_log_categories(state, r)?),
Req::SetBootstrapDaemon(r) => Resp::SetBootstrapDaemon(set_bootstrap_daemon(state, r)?),
Req::GetTransactionPool(r) => Resp::GetTransactionPool(get_transaction_pool(state, r)?),
Req::GetHeight(r) => Resp::GetHeight(get_height(state, r).await?),
Req::GetTransactions(r) => Resp::GetTransactions(get_transactions(state, r).await?),
Req::GetAltBlocksHashes(r) => {
Resp::GetAltBlocksHashes(get_alt_blocks_hashes(state, r).await?)
}
Req::IsKeyImageSpent(r) => Resp::IsKeyImageSpent(is_key_image_spent(state, r).await?),
Req::SendRawTransaction(r) => {
Resp::SendRawTransaction(send_raw_transaction(state, r).await?)
}
Req::StartMining(r) => Resp::StartMining(start_mining(state, r).await?),
Req::StopMining(r) => Resp::StopMining(stop_mining(state, r).await?),
Req::MiningStatus(r) => Resp::MiningStatus(mining_status(state, r).await?),
Req::SaveBc(r) => Resp::SaveBc(save_bc(state, r).await?),
Req::GetPeerList(r) => Resp::GetPeerList(get_peer_list(state, r).await?),
Req::SetLogHashRate(r) => Resp::SetLogHashRate(set_log_hash_rate(state, r).await?),
Req::SetLogLevel(r) => Resp::SetLogLevel(set_log_level(state, r).await?),
Req::SetLogCategories(r) => Resp::SetLogCategories(set_log_categories(state, r).await?),
Req::SetBootstrapDaemon(r) => {
Resp::SetBootstrapDaemon(set_bootstrap_daemon(state, r).await?)
}
Req::GetTransactionPool(r) => {
Resp::GetTransactionPool(get_transaction_pool(state, r).await?)
}
Req::GetTransactionPoolStats(r) => {
Resp::GetTransactionPoolStats(get_transaction_pool_stats(state, r)?)
Resp::GetTransactionPoolStats(get_transaction_pool_stats(state, r).await?)
}
Req::StopDaemon(r) => Resp::StopDaemon(stop_daemon(state, r)?),
Req::GetLimit(r) => Resp::GetLimit(get_limit(state, r)?),
Req::SetLimit(r) => Resp::SetLimit(set_limit(state, r)?),
Req::OutPeers(r) => Resp::OutPeers(out_peers(state, r)?),
Req::InPeers(r) => Resp::InPeers(in_peers(state, r)?),
Req::GetNetStats(r) => Resp::GetNetStats(get_net_stats(state, r)?),
Req::GetOuts(r) => Resp::GetOuts(get_outs(state, r)?),
Req::Update(r) => Resp::Update(update(state, r)?),
Req::PopBlocks(r) => Resp::PopBlocks(pop_blocks(state, r)?),
Req::StopDaemon(r) => Resp::StopDaemon(stop_daemon(state, r).await?),
Req::GetLimit(r) => Resp::GetLimit(get_limit(state, r).await?),
Req::SetLimit(r) => Resp::SetLimit(set_limit(state, r).await?),
Req::OutPeers(r) => Resp::OutPeers(out_peers(state, r).await?),
Req::InPeers(r) => Resp::InPeers(in_peers(state, r).await?),
Req::GetNetStats(r) => Resp::GetNetStats(get_net_stats(state, r).await?),
Req::GetOuts(r) => Resp::GetOuts(get_outs(state, r).await?),
Req::Update(r) => Resp::Update(update(state, r).await?),
Req::PopBlocks(r) => Resp::PopBlocks(pop_blocks(state, r).await?),
Req::GetTransactionPoolHashes(r) => {
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r)?)
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r).await?)
}
Req::GetPublicNodes(r) => Resp::GetPublicNodes(get_public_nodes(state, r)?),
Req::GetPublicNodes(r) => Resp::GetPublicNodes(get_public_nodes(state, r).await?),
})
}
fn get_height(
async fn get_height(
state: CupratedRpcHandler,
request: GetHeightRequest,
) -> Result<GetHeightResponse, RpcError> {
todo!()
}
fn get_transactions(
async fn get_transactions(
state: CupratedRpcHandler,
request: GetTransactionsRequest,
) -> Result<GetTransactionsResponse, RpcError> {
todo!()
}
fn get_alt_blocks_hashes(
async fn get_alt_blocks_hashes(
state: CupratedRpcHandler,
request: GetAltBlocksHashesRequest,
) -> Result<GetAltBlocksHashesResponse, RpcError> {
todo!()
}
fn is_key_image_spent(
async fn is_key_image_spent(
state: CupratedRpcHandler,
request: IsKeyImageSpentRequest,
) -> Result<IsKeyImageSpentResponse, RpcError> {
todo!()
}
fn send_raw_transaction(
async fn send_raw_transaction(
state: CupratedRpcHandler,
request: SendRawTransactionRequest,
) -> Result<SendRawTransactionResponse, RpcError> {
todo!()
}
fn start_mining(
async fn start_mining(
state: CupratedRpcHandler,
request: StartMiningRequest,
) -> Result<StartMiningResponse, RpcError> {
todo!()
}
fn stop_mining(
async fn stop_mining(
state: CupratedRpcHandler,
request: StopMiningRequest,
) -> Result<StopMiningResponse, RpcError> {
todo!()
}
fn mining_status(
async fn mining_status(
state: CupratedRpcHandler,
request: MiningStatusRequest,
) -> Result<MiningStatusResponse, RpcError> {
todo!()
}
fn save_bc(state: CupratedRpcHandler, request: SaveBcRequest) -> Result<SaveBcResponse, RpcError> {
async fn save_bc(
state: CupratedRpcHandler,
request: SaveBcRequest,
) -> Result<SaveBcResponse, RpcError> {
todo!()
}
fn get_peer_list(
async fn get_peer_list(
state: CupratedRpcHandler,
request: GetPeerListRequest,
) -> Result<GetPeerListResponse, RpcError> {
todo!()
}
fn set_log_hash_rate(
async fn set_log_hash_rate(
state: CupratedRpcHandler,
request: SetLogHashRateRequest,
) -> Result<SetLogHashRateResponse, RpcError> {
todo!()
}
fn set_log_level(
async fn set_log_level(
state: CupratedRpcHandler,
request: SetLogLevelRequest,
) -> Result<SetLogLevelResponse, RpcError> {
todo!()
}
fn set_log_categories(
async fn set_log_categories(
state: CupratedRpcHandler,
request: SetLogCategoriesRequest,
) -> Result<SetLogCategoriesResponse, RpcError> {
todo!()
}
fn set_bootstrap_daemon(
async fn set_bootstrap_daemon(
state: CupratedRpcHandler,
request: SetBootstrapDaemonRequest,
) -> Result<SetBootstrapDaemonResponse, RpcError> {
todo!()
}
fn get_transaction_pool(
async fn get_transaction_pool(
state: CupratedRpcHandler,
request: GetTransactionPoolRequest,
) -> Result<GetTransactionPoolResponse, RpcError> {
todo!()
}
fn get_transaction_pool_stats(
async fn get_transaction_pool_stats(
state: CupratedRpcHandler,
request: GetTransactionPoolStatsRequest,
) -> Result<GetTransactionPoolStatsResponse, RpcError> {
todo!()
}
fn stop_daemon(
async fn stop_daemon(
state: CupratedRpcHandler,
request: StopDaemonRequest,
) -> Result<StopDaemonResponse, RpcError> {
todo!()
}
fn get_limit(
async fn get_limit(
state: CupratedRpcHandler,
request: GetLimitRequest,
) -> Result<GetLimitResponse, RpcError> {
todo!()
}
fn set_limit(
async fn set_limit(
state: CupratedRpcHandler,
request: SetLimitRequest,
) -> Result<SetLimitResponse, RpcError> {
todo!()
}
fn out_peers(
async fn out_peers(
state: CupratedRpcHandler,
request: OutPeersRequest,
) -> Result<OutPeersResponse, RpcError> {
todo!()
}
fn in_peers(
async fn in_peers(
state: CupratedRpcHandler,
request: InPeersRequest,
) -> Result<InPeersResponse, RpcError> {
todo!()
}
fn get_net_stats(
async fn get_net_stats(
state: CupratedRpcHandler,
request: GetNetStatsRequest,
) -> Result<GetNetStatsResponse, RpcError> {
todo!()
}
fn get_outs(
async fn get_outs(
state: CupratedRpcHandler,
request: GetOutsRequest,
) -> Result<GetOutsResponse, RpcError> {
todo!()
}
fn update(state: CupratedRpcHandler, request: UpdateRequest) -> Result<UpdateResponse, RpcError> {
async fn update(
state: CupratedRpcHandler,
request: UpdateRequest,
) -> Result<UpdateResponse, RpcError> {
todo!()
}
fn pop_blocks(
async fn pop_blocks(
state: CupratedRpcHandler,
request: PopBlocksRequest,
) -> Result<PopBlocksResponse, RpcError> {
todo!()
}
fn get_transaction_pool_hashes(
async fn get_transaction_pool_hashes(
state: CupratedRpcHandler,
request: GetTransactionPoolHashesRequest,
) -> Result<GetTransactionPoolHashesResponse, RpcError> {
todo!()
}
fn get_public_nodes(
async fn get_public_nodes(
state: CupratedRpcHandler,
request: GetPublicNodesRequest,
) -> Result<GetPublicNodesResponse, RpcError> {