mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-22 11:39:30 +00:00
fixes
This commit is contained in:
parent
4f3b943b12
commit
d85e9c814c
4 changed files with 39 additions and 26 deletions
|
@ -14,13 +14,14 @@ use cuprate_rpc_types::json::{
|
|||
GetCoinbaseTxSumRequest, GetCoinbaseTxSumResponse, GetConnectionsRequest,
|
||||
GetConnectionsResponse, GetFeeEstimateRequest, GetFeeEstimateResponse, GetInfoRequest,
|
||||
GetInfoResponse, GetLastBlockHeaderRequest, GetLastBlockHeaderResponse, GetMinerDataRequest,
|
||||
GetMinerDataResponse, GetOutputHistogramV2Request, GetOutputHistogramV2Response,
|
||||
GetTransactionPoolBacklogV2Request, GetTransactionPoolBacklogV2Response, GetTxIdsLooseRequest,
|
||||
GetTxIdsLooseResponse, GetVersionRequest, GetVersionResponse, HardForkInfoRequest,
|
||||
HardForkInfoResponse, JsonRpcRequest, JsonRpcResponse, OnGetBlockHashRequest,
|
||||
OnGetBlockHashResponse, PruneBlockchainRequest, PruneBlockchainResponse, RelayTxRequest,
|
||||
RelayTxResponse, SetBansRequest, SetBansResponse, SubmitBlockRequest, SubmitBlockResponse,
|
||||
SyncInfoRequest, SyncInfoResponse,
|
||||
GetMinerDataResponse, GetOutputDistributionV2Request, GetOutputDistributionV2Response,
|
||||
GetOutputHistogramRequest, GetOutputHistogramResponse, GetTransactionPoolBacklogV2Request,
|
||||
GetTransactionPoolBacklogV2Response, GetTxIdsLooseRequest, GetTxIdsLooseResponse,
|
||||
GetVersionRequest, GetVersionResponse, HardForkInfoRequest, HardForkInfoResponse,
|
||||
JsonRpcRequest, JsonRpcResponse, OnGetBlockHashRequest, OnGetBlockHashResponse,
|
||||
PruneBlockchainRequest, PruneBlockchainResponse, RelayTxRequest, RelayTxResponse,
|
||||
SetBansRequest, SetBansResponse, SubmitBlockRequest, SubmitBlockResponse, SyncInfoRequest,
|
||||
SyncInfoResponse,
|
||||
};
|
||||
|
||||
use crate::rpc::CupratedRpcHandler;
|
||||
|
@ -60,8 +61,8 @@ pub(super) async fn map_request(
|
|||
Req::FlushTransactionPool(r) => {
|
||||
Resp::FlushTransactionPool(flush_transaction_pool(state, r).await?)
|
||||
}
|
||||
Req::GetOutputHistogramV2(r) => {
|
||||
Resp::GetOutputHistogramV2(get_output_histogram_v2(state, r).await?)
|
||||
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?),
|
||||
|
@ -74,6 +75,9 @@ pub(super) async fn map_request(
|
|||
Req::GetTransactionPoolBacklogV2(r) => {
|
||||
Resp::GetTransactionPoolBacklogV2(get_transaction_pool_backlog_v2(state, r).await?)
|
||||
}
|
||||
Req::GetOutputDistributionV2(r) => {
|
||||
Resp::GetOutputDistributionV2(get_output_distribution_v2(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?),
|
||||
|
@ -195,10 +199,10 @@ async fn flush_transaction_pool(
|
|||
todo!()
|
||||
}
|
||||
|
||||
async fn get_output_histogram_v2(
|
||||
async fn get_output_histogram(
|
||||
state: CupratedRpcHandler,
|
||||
request: GetOutputHistogramV2Request,
|
||||
) -> Result<GetOutputHistogramV2Response, Error> {
|
||||
request: GetOutputHistogramRequest,
|
||||
) -> Result<GetOutputHistogramResponse, Error> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
@ -251,6 +255,13 @@ async fn get_transaction_pool_backlog_v2(
|
|||
todo!()
|
||||
}
|
||||
|
||||
async fn get_output_distribution_v2(
|
||||
state: CupratedRpcHandler,
|
||||
request: GetOutputDistributionV2Request,
|
||||
) -> Result<GetOutputDistributionV2Response, Error> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn get_miner_data(
|
||||
state: CupratedRpcHandler,
|
||||
request: GetMinerDataRequest,
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Service<JsonRpcRequest> for RpcHandlerDummy {
|
|||
Req::GetBans(_) => Resp::GetBans(Default::default()),
|
||||
Req::Banned(_) => Resp::Banned(Default::default()),
|
||||
Req::FlushTransactionPool(_) => Resp::FlushTransactionPool(Default::default()),
|
||||
Req::GetOutputHistogramV2(_) => Resp::GetOutputHistogramV2(Default::default()),
|
||||
Req::GetOutputHistogram(_) => Resp::GetOutputHistogram(Default::default()),
|
||||
Req::GetCoinbaseTxSum(_) => Resp::GetCoinbaseTxSum(Default::default()),
|
||||
Req::GetVersion(_) => Resp::GetVersion(Default::default()),
|
||||
Req::GetFeeEstimate(_) => Resp::GetFeeEstimate(Default::default()),
|
||||
|
@ -85,6 +85,7 @@ impl Service<JsonRpcRequest> for RpcHandlerDummy {
|
|||
Req::GetTransactionPoolBacklogV2(_) => {
|
||||
Resp::GetTransactionPoolBacklogV2(Default::default())
|
||||
}
|
||||
Req::GetOutputDistributionV2(_) => Resp::GetOutputDistributionV2(Default::default()),
|
||||
Req::GetMinerData(_) => Resp::GetMinerData(Default::default()),
|
||||
Req::PruneBlockchain(_) => Resp::PruneBlockchain(Default::default()),
|
||||
Req::CalcPow(_) => Resp::CalcPow(Default::default()),
|
||||
|
|
|
@ -971,15 +971,14 @@ define_request_and_response! {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: update after finalizing <https://github.com/monero-project/monero/issues/9422>.
|
||||
define_request_and_response! {
|
||||
get_output_histogram_v2,
|
||||
get_output_histogram,
|
||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||
core_rpc_server_commands_defs.h => 2118..=2168,
|
||||
GetOutputHistogramV2,
|
||||
GetOutputHistogram,
|
||||
|
||||
#[doc = serde_doc_test!(
|
||||
GET_OUTPUT_HISTOGRAM_V2_REQUEST => GetOutputHistogramV2Request {
|
||||
GET_OUTPUT_HISTOGRAM_REQUEST => GetOutputHistogramRequest {
|
||||
amounts: vec![20000000000],
|
||||
min_count: 0,
|
||||
max_count: 0,
|
||||
|
@ -996,7 +995,7 @@ define_request_and_response! {
|
|||
},
|
||||
|
||||
#[doc = serde_doc_test!(
|
||||
GET_OUTPUT_HISTOGRAM_V2_RESPONSE => GetOutputHistogramV2Response {
|
||||
GET_OUTPUT_HISTOGRAM_RESPONSE => GetOutputHistogramResponse {
|
||||
base: AccessResponseBase::OK,
|
||||
histogram: vec![HistogramEntry {
|
||||
amount: 20000000000,
|
||||
|
@ -1385,7 +1384,6 @@ define_request_and_response! {
|
|||
base: 0,
|
||||
distribution: vec![0, 1, 2],
|
||||
amount: 2628780000,
|
||||
binary: true,
|
||||
})],
|
||||
}
|
||||
)]
|
||||
|
@ -1618,7 +1616,7 @@ pub enum JsonRpcRequest {
|
|||
GetBans(GetBansRequest),
|
||||
Banned(BannedRequest),
|
||||
FlushTransactionPool(FlushTransactionPoolRequest),
|
||||
GetOutputHistogramV2(GetOutputHistogramV2Request),
|
||||
GetOutputHistogram(GetOutputHistogramRequest),
|
||||
GetCoinbaseTxSum(GetCoinbaseTxSumRequest),
|
||||
GetVersion(GetVersionRequest),
|
||||
GetFeeEstimate(GetFeeEstimateRequest),
|
||||
|
@ -1626,6 +1624,7 @@ pub enum JsonRpcRequest {
|
|||
RelayTx(RelayTxRequest),
|
||||
SyncInfo(SyncInfoRequest),
|
||||
GetTransactionPoolBacklogV2(GetTransactionPoolBacklogV2Request),
|
||||
GetOutputDistributionV2(GetOutputDistributionV2Request),
|
||||
GetMinerData(GetMinerDataRequest),
|
||||
PruneBlockchain(PruneBlockchainRequest),
|
||||
CalcPow(CalcPowRequest),
|
||||
|
@ -1647,10 +1646,11 @@ impl RpcCallValue for JsonRpcRequest {
|
|||
Self::GetBlock(x) => x.is_restricted(),
|
||||
Self::GetInfo(x) => x.is_restricted(),
|
||||
Self::HardForkInfo(x) => x.is_restricted(),
|
||||
Self::GetOutputHistogramV2(x) => x.is_restricted(),
|
||||
Self::GetOutputHistogram(x) => x.is_restricted(),
|
||||
Self::GetVersion(x) => x.is_restricted(),
|
||||
Self::GetFeeEstimate(x) => x.is_restricted(),
|
||||
Self::GetTransactionPoolBacklogV2(x) => x.is_restricted(),
|
||||
Self::GetOutputDistributionV2(x) => x.is_restricted(),
|
||||
Self::GetMinerData(x) => x.is_restricted(),
|
||||
Self::AddAuxPow(x) => x.is_restricted(),
|
||||
Self::GetTxIdsLoose(x) => x.is_restricted(),
|
||||
|
@ -1682,10 +1682,11 @@ impl RpcCallValue for JsonRpcRequest {
|
|||
Self::GetBlock(x) => x.is_empty(),
|
||||
Self::GetInfo(x) => x.is_empty(),
|
||||
Self::HardForkInfo(x) => x.is_empty(),
|
||||
Self::GetOutputHistogramV2(x) => x.is_empty(),
|
||||
Self::GetOutputHistogram(x) => x.is_empty(),
|
||||
Self::GetVersion(x) => x.is_empty(),
|
||||
Self::GetFeeEstimate(x) => x.is_empty(),
|
||||
Self::GetTransactionPoolBacklogV2(x) => x.is_empty(),
|
||||
Self::GetOutputDistributionV2(x) => x.is_empty(),
|
||||
Self::GetMinerData(x) => x.is_empty(),
|
||||
Self::AddAuxPow(x) => x.is_empty(),
|
||||
Self::GetTxIdsLoose(x) => x.is_empty(),
|
||||
|
@ -1750,7 +1751,7 @@ pub enum JsonRpcResponse {
|
|||
GetBans(GetBansResponse),
|
||||
Banned(BannedResponse),
|
||||
FlushTransactionPool(FlushTransactionPoolResponse),
|
||||
GetOutputHistogramV2(GetOutputHistogramV2Response),
|
||||
GetOutputHistogram(GetOutputHistogramResponse),
|
||||
GetCoinbaseTxSum(GetCoinbaseTxSumResponse),
|
||||
GetVersion(GetVersionResponse),
|
||||
GetFeeEstimate(GetFeeEstimateResponse),
|
||||
|
@ -1758,6 +1759,7 @@ pub enum JsonRpcResponse {
|
|||
RelayTx(RelayTxResponse),
|
||||
SyncInfo(SyncInfoResponse),
|
||||
GetTransactionPoolBacklogV2(GetTransactionPoolBacklogV2Response),
|
||||
GetOutputDistributionV2(GetOutputDistributionV2Response),
|
||||
GetMinerData(GetMinerDataResponse),
|
||||
PruneBlockchain(PruneBlockchainResponse),
|
||||
CalcPow(CalcPowResponse),
|
||||
|
|
|
@ -1118,9 +1118,8 @@ r#"{
|
|||
"distributions": [{
|
||||
"amount": 2628780000,
|
||||
"base": 0,
|
||||
"distribution": "",
|
||||
"start_height": 1462078,
|
||||
"binary": false
|
||||
"distribution": [0, 1, 2],
|
||||
"start_height": 1462078
|
||||
}],
|
||||
"status": "OK",
|
||||
"top_hash": "",
|
||||
|
|
Loading…
Reference in a new issue