mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-25 12:05:51 +00:00
apply diffs
This commit is contained in:
parent
f3c1a5c2aa
commit
7c7f64101f
8 changed files with 164 additions and 115 deletions
|
@ -1,13 +1,12 @@
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
|
|
||||||
use cuprate_rpc_types::{
|
use cuprate_rpc_types::bin::{
|
||||||
bin::{
|
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksByHeightResponse, GetBlocksRequest,
|
||||||
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksByHeightResponse,
|
GetBlocksResponse, GetHashesRequest, GetHashesResponse, GetOutputDistributionRequest,
|
||||||
GetBlocksRequest, GetBlocksResponse, GetHashesRequest, GetHashesResponse,
|
GetOutputDistributionResponse, GetOutputIndexesRequest, GetOutputIndexesResponse,
|
||||||
GetOutputIndexesRequest, GetOutputIndexesResponse, GetOutsRequest, GetOutsResponse,
|
GetOutsRequest, GetOutsResponse, GetTransactionPoolBacklogRequest,
|
||||||
GetTransactionPoolHashesRequest, GetTransactionPoolHashesResponse,
|
GetTransactionPoolBacklogResponse, GetTransactionPoolHashesRequest,
|
||||||
},
|
GetTransactionPoolHashesResponse,
|
||||||
json::{GetOutputDistributionRequest, GetOutputDistributionResponse},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::rpc::CupratedRpcHandler;
|
use crate::rpc::CupratedRpcHandler;
|
||||||
|
@ -29,6 +28,9 @@ pub(super) async fn map_request(
|
||||||
Req::GetTransactionPoolHashes(r) => {
|
Req::GetTransactionPoolHashes(r) => {
|
||||||
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r).await?)
|
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r).await?)
|
||||||
}
|
}
|
||||||
|
Req::GetTransactionPoolBacklog(r) => {
|
||||||
|
Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r).await?)
|
||||||
|
}
|
||||||
Req::GetOutputDistribution(r) => {
|
Req::GetOutputDistribution(r) => {
|
||||||
Resp::GetOutputDistribution(get_output_distribution(state, r).await?)
|
Resp::GetOutputDistribution(get_output_distribution(state, r).await?)
|
||||||
}
|
}
|
||||||
|
@ -77,6 +79,13 @@ async fn get_transaction_pool_hashes(
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn get_transaction_pool_backlog(
|
||||||
|
state: CupratedRpcHandler,
|
||||||
|
request: GetTransactionPoolBacklogRequest,
|
||||||
|
) -> Result<GetTransactionPoolBacklogResponse, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
async fn get_output_distribution(
|
async fn get_output_distribution(
|
||||||
state: CupratedRpcHandler,
|
state: CupratedRpcHandler,
|
||||||
request: GetOutputDistributionRequest,
|
request: GetOutputDistributionRequest,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::sync::Arc;
|
use std::{convert::Infallible, sync::Arc};
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use tower::ServiceExt;
|
use tower::ServiceExt;
|
||||||
|
@ -14,8 +14,8 @@ use cuprate_rpc_types::json::{
|
||||||
GetCoinbaseTxSumRequest, GetCoinbaseTxSumResponse, GetConnectionsRequest,
|
GetCoinbaseTxSumRequest, GetCoinbaseTxSumResponse, GetConnectionsRequest,
|
||||||
GetConnectionsResponse, GetFeeEstimateRequest, GetFeeEstimateResponse, GetInfoRequest,
|
GetConnectionsResponse, GetFeeEstimateRequest, GetFeeEstimateResponse, GetInfoRequest,
|
||||||
GetInfoResponse, GetLastBlockHeaderRequest, GetLastBlockHeaderResponse, GetMinerDataRequest,
|
GetInfoResponse, GetLastBlockHeaderRequest, GetLastBlockHeaderResponse, GetMinerDataRequest,
|
||||||
GetMinerDataResponse, GetOutputHistogramRequest, GetOutputHistogramResponse,
|
GetMinerDataResponse, GetOutputHistogramV2Request, GetOutputHistogramV2Response,
|
||||||
GetTransactionPoolBacklogRequest, GetTransactionPoolBacklogResponse, GetTxIdsLooseRequest,
|
GetTransactionPoolBacklogV2Request, GetTransactionPoolBacklogV2Response, GetTxIdsLooseRequest,
|
||||||
GetTxIdsLooseResponse, GetVersionRequest, GetVersionResponse, HardForkInfoRequest,
|
GetTxIdsLooseResponse, GetVersionRequest, GetVersionResponse, HardForkInfoRequest,
|
||||||
HardForkInfoResponse, JsonRpcRequest, JsonRpcResponse, OnGetBlockHashRequest,
|
HardForkInfoResponse, JsonRpcRequest, JsonRpcResponse, OnGetBlockHashRequest,
|
||||||
OnGetBlockHashResponse, PruneBlockchainRequest, PruneBlockchainResponse, RelayTxRequest,
|
OnGetBlockHashResponse, PruneBlockchainRequest, PruneBlockchainResponse, RelayTxRequest,
|
||||||
|
@ -60,8 +60,8 @@ pub(super) async fn map_request(
|
||||||
Req::FlushTransactionPool(r) => {
|
Req::FlushTransactionPool(r) => {
|
||||||
Resp::FlushTransactionPool(flush_transaction_pool(state, r).await?)
|
Resp::FlushTransactionPool(flush_transaction_pool(state, r).await?)
|
||||||
}
|
}
|
||||||
Req::GetOutputHistogram(r) => {
|
Req::GetOutputHistogramV2(r) => {
|
||||||
Resp::GetOutputHistogram(get_output_histogram(state, r).await?)
|
Resp::GetOutputHistogramV2(get_output_histogram_v2(state, r).await?)
|
||||||
}
|
}
|
||||||
Req::GetCoinbaseTxSum(r) => Resp::GetCoinbaseTxSum(get_coinbase_tx_sum(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::GetVersion(r) => Resp::GetVersion(get_version(state, r).await?),
|
||||||
|
@ -71,8 +71,8 @@ pub(super) async fn map_request(
|
||||||
}
|
}
|
||||||
Req::RelayTx(r) => Resp::RelayTx(relay_tx(state, r).await?),
|
Req::RelayTx(r) => Resp::RelayTx(relay_tx(state, r).await?),
|
||||||
Req::SyncInfo(r) => Resp::SyncInfo(sync_info(state, r).await?),
|
Req::SyncInfo(r) => Resp::SyncInfo(sync_info(state, r).await?),
|
||||||
Req::GetTransactionPoolBacklog(r) => {
|
Req::GetTransactionPoolBacklogV2(r) => {
|
||||||
Resp::GetTransactionPoolBacklog(get_transaction_pool_backlog(state, r).await?)
|
Resp::GetTransactionPoolBacklogV2(get_transaction_pool_backlog_v2(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?),
|
||||||
|
@ -195,10 +195,10 @@ async fn flush_transaction_pool(
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_output_histogram(
|
async fn get_output_histogram_v2(
|
||||||
state: CupratedRpcHandler,
|
state: CupratedRpcHandler,
|
||||||
request: GetOutputHistogramRequest,
|
request: GetOutputHistogramV2Request,
|
||||||
) -> Result<GetOutputHistogramResponse, Error> {
|
) -> Result<GetOutputHistogramV2Response, Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,10 +244,10 @@ async fn sync_info(
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_transaction_pool_backlog(
|
async fn get_transaction_pool_backlog_v2(
|
||||||
state: CupratedRpcHandler,
|
state: CupratedRpcHandler,
|
||||||
request: GetTransactionPoolBacklogRequest,
|
request: GetTransactionPoolBacklogV2Request,
|
||||||
) -> Result<GetTransactionPoolBacklogResponse, Error> {
|
) -> Result<GetTransactionPoolBacklogV2Response, Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,10 @@ use cuprate_epee_encoding::from_bytes;
|
||||||
use cuprate_rpc_types::{
|
use cuprate_rpc_types::{
|
||||||
bin::{
|
bin::{
|
||||||
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksRequest, GetHashesRequest,
|
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksRequest, GetHashesRequest,
|
||||||
GetOutputIndexesRequest, GetOutsRequest, GetTransactionPoolHashesRequest,
|
GetOutputDistributionRequest, GetOutputIndexesRequest, GetOutsRequest,
|
||||||
|
GetTransactionPoolBacklogRequest, GetTransactionPoolBacklogResponse,
|
||||||
|
GetTransactionPoolHashesRequest,
|
||||||
},
|
},
|
||||||
json::GetOutputDistributionRequest,
|
|
||||||
RpcCall,
|
RpcCall,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,7 +103,8 @@ generate_endpoints_with_input! {
|
||||||
get_hashes => GetHashes,
|
get_hashes => GetHashes,
|
||||||
get_o_indexes => GetOutputIndexes,
|
get_o_indexes => GetOutputIndexes,
|
||||||
get_outs => GetOuts,
|
get_outs => GetOuts,
|
||||||
get_output_distribution => GetOutputDistribution
|
get_output_distribution => GetOutputDistribution,
|
||||||
|
get_txpool_backlog => GetTransactionPoolBacklog
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_endpoints_with_no_input! {
|
generate_endpoints_with_no_input! {
|
||||||
|
|
|
@ -75,15 +75,15 @@ impl Service<JsonRpcRequest> for RpcHandlerDummy {
|
||||||
Req::GetBans(_) => Resp::GetBans(Default::default()),
|
Req::GetBans(_) => Resp::GetBans(Default::default()),
|
||||||
Req::Banned(_) => Resp::Banned(Default::default()),
|
Req::Banned(_) => Resp::Banned(Default::default()),
|
||||||
Req::FlushTransactionPool(_) => Resp::FlushTransactionPool(Default::default()),
|
Req::FlushTransactionPool(_) => Resp::FlushTransactionPool(Default::default()),
|
||||||
Req::GetOutputHistogram(_) => Resp::GetOutputHistogram(Default::default()),
|
Req::GetOutputHistogramV2(_) => Resp::GetOutputHistogramV2(Default::default()),
|
||||||
Req::GetCoinbaseTxSum(_) => Resp::GetCoinbaseTxSum(Default::default()),
|
Req::GetCoinbaseTxSum(_) => Resp::GetCoinbaseTxSum(Default::default()),
|
||||||
Req::GetVersion(_) => Resp::GetVersion(Default::default()),
|
Req::GetVersion(_) => Resp::GetVersion(Default::default()),
|
||||||
Req::GetFeeEstimate(_) => Resp::GetFeeEstimate(Default::default()),
|
Req::GetFeeEstimate(_) => Resp::GetFeeEstimate(Default::default()),
|
||||||
Req::GetAlternateChains(_) => Resp::GetAlternateChains(Default::default()),
|
Req::GetAlternateChains(_) => Resp::GetAlternateChains(Default::default()),
|
||||||
Req::RelayTx(_) => Resp::RelayTx(Default::default()),
|
Req::RelayTx(_) => Resp::RelayTx(Default::default()),
|
||||||
Req::SyncInfo(_) => Resp::SyncInfo(Default::default()),
|
Req::SyncInfo(_) => Resp::SyncInfo(Default::default()),
|
||||||
Req::GetTransactionPoolBacklog(_) => {
|
Req::GetTransactionPoolBacklogV2(_) => {
|
||||||
Resp::GetTransactionPoolBacklog(Default::default())
|
Resp::GetTransactionPoolBacklogV2(Default::default())
|
||||||
}
|
}
|
||||||
Req::GetMinerData(_) => Resp::GetMinerData(Default::default()),
|
Req::GetMinerData(_) => Resp::GetMinerData(Default::default()),
|
||||||
Req::PruneBlockchain(_) => Resp::PruneBlockchain(Default::default()),
|
Req::PruneBlockchain(_) => Resp::PruneBlockchain(Default::default()),
|
||||||
|
@ -120,6 +120,9 @@ impl Service<BinRequest> for RpcHandlerDummy {
|
||||||
Req::GetOutputIndexes(_) => Resp::GetOutputIndexes(Default::default()),
|
Req::GetOutputIndexes(_) => Resp::GetOutputIndexes(Default::default()),
|
||||||
Req::GetOuts(_) => Resp::GetOuts(Default::default()),
|
Req::GetOuts(_) => Resp::GetOuts(Default::default()),
|
||||||
Req::GetTransactionPoolHashes(_) => Resp::GetTransactionPoolHashes(Default::default()),
|
Req::GetTransactionPoolHashes(_) => Resp::GetTransactionPoolHashes(Default::default()),
|
||||||
|
Req::GetTransactionPoolBacklog(_) => {
|
||||||
|
Resp::GetTransactionPoolBacklog(Default::default())
|
||||||
|
}
|
||||||
Req::GetOutputDistribution(_) => Resp::GetOutputDistribution(Default::default()),
|
Req::GetOutputDistribution(_) => Resp::GetOutputDistribution(Default::default()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,29 +45,16 @@ For example:
|
||||||
| [`/get_blocks.bin`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_blockbin) | [`bin::GetBlocksRequest`] & [`bin::GetBlocksResponse`]
|
| [`/get_blocks.bin`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_blockbin) | [`bin::GetBlocksRequest`] & [`bin::GetBlocksResponse`]
|
||||||
| [`/get_height`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_height) | [`other::GetHeightRequest`] & [`other::GetHeightResponse`]
|
| [`/get_height`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_height) | [`other::GetHeightRequest`] & [`other::GetHeightResponse`]
|
||||||
|
|
||||||
# Mixed types
|
# Deprecated types
|
||||||
Note that some types mix JSON & binary together, i.e., the message overall is JSON,
|
TODO: update after finalizing <https://github.com/monero-project/monero/issues/9422>.
|
||||||
however some fields contain binary values inside JSON strings, for example:
|
|
||||||
|
|
||||||
```json
|
- [`crate::json::GetTransactionPoolBacklogV2Response`]
|
||||||
{
|
- [`crate::json::GetOutputDistributionV2Response`]
|
||||||
"string": "",
|
|
||||||
"float": 30.0,
|
|
||||||
"integer": 30,
|
|
||||||
"binary": "<serialized binary>"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`binary` here is (de)serialized as a normal [`String`]. In order to be clear on which fields contain binary data, the struct fields that have them will use [`crate::misc::BinaryString`] instead of [`String`].
|
# Optimized types
|
||||||
|
TODO: updated after deciding compatability <-> optimization tradeoff.
|
||||||
|
|
||||||
These mixed types are:
|
- Fixed byte containers
|
||||||
- [`crate::json::GetTransactionPoolBacklogResponse`]
|
|
||||||
- [`crate::json::GetOutputDistributionResponse`]
|
|
||||||
|
|
||||||
TODO: we need to figure out a type that (de)serializes correctly, `String` errors with `serde_json`
|
|
||||||
|
|
||||||
# Fixed byte containers
|
|
||||||
TODO
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
|
|
|
@ -21,16 +21,52 @@ use cuprate_types::BlockCompleteEntry;
|
||||||
use crate::{
|
use crate::{
|
||||||
base::AccessResponseBase,
|
base::AccessResponseBase,
|
||||||
macros::{define_request, define_request_and_response, define_request_and_response_doc},
|
macros::{define_request, define_request_and_response, define_request_and_response_doc},
|
||||||
misc::{BlockOutputIndices, GetOutputsOut, OutKeyBin, PoolTxInfo, Status},
|
misc::{
|
||||||
|
BlockOutputIndices, Distribution, GetOutputsOut, OutKeyBin, PoolTxInfo, Status,
|
||||||
|
TxBacklogEntry,
|
||||||
|
},
|
||||||
rpc_call::RpcCallValue,
|
rpc_call::RpcCallValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(feature = "epee", feature = "serde"))]
|
#[cfg(any(feature = "epee", feature = "serde"))]
|
||||||
use crate::defaults::{default_false, default_zero};
|
use crate::defaults::{default_false, default_true, default_zero};
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
use crate::misc::PoolInfoExtent;
|
use crate::misc::PoolInfoExtent;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Definitions
|
//---------------------------------------------------------------------------------------------------- Definitions
|
||||||
|
define_request_and_response! {
|
||||||
|
get_txpool_backlogbin,
|
||||||
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
|
core_rpc_server_commands_defs.h => 1637..=1664,
|
||||||
|
GetTransactionPoolBacklog (empty),
|
||||||
|
Request {},
|
||||||
|
|
||||||
|
AccessResponseBase {
|
||||||
|
backlog: Vec<TxBacklogEntry>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define_request_and_response! {
|
||||||
|
get_output_distributionbin,
|
||||||
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
|
core_rpc_server_commands_defs.h => 2445..=2520,
|
||||||
|
|
||||||
|
GetOutputDistribution,
|
||||||
|
|
||||||
|
Request {
|
||||||
|
amounts: Vec<u64>,
|
||||||
|
binary: bool = default_true(), "default_true",
|
||||||
|
compress: bool = default_false(), "default_false",
|
||||||
|
cumulative: bool = default_false(), "default_false",
|
||||||
|
from_height: u64 = default_zero::<u64>(), "default_zero",
|
||||||
|
to_height: u64 = default_zero::<u64>(), "default_zero",
|
||||||
|
},
|
||||||
|
|
||||||
|
AccessResponseBase {
|
||||||
|
distributions: Vec<Distribution>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
define_request_and_response! {
|
define_request_and_response! {
|
||||||
get_blocks_by_heightbin,
|
get_blocks_by_heightbin,
|
||||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
|
@ -403,7 +439,8 @@ pub enum BinRequest {
|
||||||
GetOutputIndexes(GetOutputIndexesRequest),
|
GetOutputIndexes(GetOutputIndexesRequest),
|
||||||
GetOuts(GetOutsRequest),
|
GetOuts(GetOutsRequest),
|
||||||
GetTransactionPoolHashes(GetTransactionPoolHashesRequest),
|
GetTransactionPoolHashes(GetTransactionPoolHashesRequest),
|
||||||
GetOutputDistribution(crate::json::GetOutputDistributionRequest),
|
GetTransactionPoolBacklog(GetTransactionPoolBacklogRequest),
|
||||||
|
GetOutputDistribution(GetOutputDistributionRequest),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RpcCallValue for BinRequest {
|
impl RpcCallValue for BinRequest {
|
||||||
|
@ -415,6 +452,7 @@ impl RpcCallValue for BinRequest {
|
||||||
Self::GetOutputIndexes(x) => x.is_restricted(),
|
Self::GetOutputIndexes(x) => x.is_restricted(),
|
||||||
Self::GetOuts(x) => x.is_restricted(),
|
Self::GetOuts(x) => x.is_restricted(),
|
||||||
Self::GetTransactionPoolHashes(x) => x.is_restricted(),
|
Self::GetTransactionPoolHashes(x) => x.is_restricted(),
|
||||||
|
Self::GetTransactionPoolBacklog(x) => x.is_restricted(),
|
||||||
Self::GetOutputDistribution(x) => x.is_restricted(),
|
Self::GetOutputDistribution(x) => x.is_restricted(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,6 +465,7 @@ impl RpcCallValue for BinRequest {
|
||||||
Self::GetOutputIndexes(x) => x.is_empty(),
|
Self::GetOutputIndexes(x) => x.is_empty(),
|
||||||
Self::GetOuts(x) => x.is_empty(),
|
Self::GetOuts(x) => x.is_empty(),
|
||||||
Self::GetTransactionPoolHashes(x) => x.is_empty(),
|
Self::GetTransactionPoolHashes(x) => x.is_empty(),
|
||||||
|
Self::GetTransactionPoolBacklog(x) => x.is_empty(),
|
||||||
Self::GetOutputDistribution(x) => x.is_empty(),
|
Self::GetOutputDistribution(x) => x.is_empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,7 +487,8 @@ pub enum BinResponse {
|
||||||
GetOutputIndexes(GetOutputIndexesResponse),
|
GetOutputIndexes(GetOutputIndexesResponse),
|
||||||
GetOuts(GetOutsResponse),
|
GetOuts(GetOutsResponse),
|
||||||
GetTransactionPoolHashes(GetTransactionPoolHashesResponse),
|
GetTransactionPoolHashes(GetTransactionPoolHashesResponse),
|
||||||
GetOutputDistribution(crate::json::GetOutputDistributionResponse),
|
GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse),
|
||||||
|
GetOutputDistribution(GetOutputDistributionResponse),
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Tests
|
//---------------------------------------------------------------------------------------------------- Tests
|
||||||
|
|
|
@ -971,14 +971,15 @@ define_request_and_response! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: update after finalizing <https://github.com/monero-project/monero/issues/9422>.
|
||||||
define_request_and_response! {
|
define_request_and_response! {
|
||||||
get_output_histogram,
|
get_output_histogram_v2,
|
||||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
core_rpc_server_commands_defs.h => 2118..=2168,
|
core_rpc_server_commands_defs.h => 2118..=2168,
|
||||||
GetOutputHistogram,
|
GetOutputHistogramV2,
|
||||||
|
|
||||||
#[doc = serde_doc_test!(
|
#[doc = serde_doc_test!(
|
||||||
GET_OUTPUT_HISTOGRAM_REQUEST => GetOutputHistogramRequest {
|
GET_OUTPUT_HISTOGRAM_V2_REQUEST => GetOutputHistogramV2Request {
|
||||||
amounts: vec![20000000000],
|
amounts: vec![20000000000],
|
||||||
min_count: 0,
|
min_count: 0,
|
||||||
max_count: 0,
|
max_count: 0,
|
||||||
|
@ -995,7 +996,7 @@ define_request_and_response! {
|
||||||
},
|
},
|
||||||
|
|
||||||
#[doc = serde_doc_test!(
|
#[doc = serde_doc_test!(
|
||||||
GET_OUTPUT_HISTOGRAM_RESPONSE => GetOutputHistogramResponse {
|
GET_OUTPUT_HISTOGRAM_V2_RESPONSE => GetOutputHistogramV2Response {
|
||||||
base: AccessResponseBase::OK,
|
base: AccessResponseBase::OK,
|
||||||
histogram: vec![HistogramEntry {
|
histogram: vec![HistogramEntry {
|
||||||
amount: 20000000000,
|
amount: 20000000000,
|
||||||
|
@ -1324,38 +1325,41 @@ define_request_and_response! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: update after finalizing <https://github.com/monero-project/monero/issues/9422>.
|
||||||
define_request_and_response! {
|
define_request_and_response! {
|
||||||
get_txpool_backlog,
|
get_txpool_backlog_v2,
|
||||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
core_rpc_server_commands_defs.h => 1637..=1664,
|
core_rpc_server_commands_defs.h => 1637..=1664,
|
||||||
GetTransactionPoolBacklog (empty),
|
GetTransactionPoolBacklogV2 (empty),
|
||||||
Request {},
|
Request {},
|
||||||
|
|
||||||
// TODO: enable test after binary string impl.
|
#[doc = serde_doc_test!(
|
||||||
// #[doc = serde_doc_test!(
|
GET_TRANSACTION_POOL_BACKLOG_V2_RESPONSE => GetTransactionPoolBacklogV2Response {
|
||||||
// GET_TRANSACTION_POOL_BACKLOG_RESPONSE => GetTransactionPoolBacklogResponse {
|
base: ResponseBase::OK,
|
||||||
// base: ResponseBase::OK,
|
backlog: vec![
|
||||||
// backlog: "...Binary...".into(),
|
TxBacklogEntry {
|
||||||
// }
|
weight: 0,
|
||||||
// )]
|
fee: 0,
|
||||||
|
time_in_pool: 0,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)]
|
||||||
ResponseBase {
|
ResponseBase {
|
||||||
// TODO: this is a [`BinaryString`].
|
|
||||||
backlog: Vec<TxBacklogEntry>,
|
backlog: Vec<TxBacklogEntry>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: update after finalizing <https://github.com/monero-project/monero/issues/9422>.
|
||||||
define_request_and_response! {
|
define_request_and_response! {
|
||||||
get_output_distribution,
|
get_output_distribution_v2,
|
||||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||||
core_rpc_server_commands_defs.h => 2445..=2520,
|
core_rpc_server_commands_defs.h => 2445..=2520,
|
||||||
|
|
||||||
/// This type is also used in the (undocumented)
|
GetOutputDistributionV2,
|
||||||
/// [`/get_output_distribution.bin`](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.h#L138)
|
|
||||||
/// binary endpoint.
|
|
||||||
GetOutputDistribution,
|
|
||||||
|
|
||||||
#[doc = serde_doc_test!(
|
#[doc = serde_doc_test!(
|
||||||
GET_OUTPUT_DISTRIBUTION_REQUEST => GetOutputDistributionRequest {
|
GET_OUTPUT_DISTRIBUTION_V2_REQUEST => GetOutputDistributionV2Request {
|
||||||
amounts: vec![628780000],
|
amounts: vec![628780000],
|
||||||
from_height: 1462078,
|
from_height: 1462078,
|
||||||
binary: true,
|
binary: true,
|
||||||
|
@ -1373,19 +1377,18 @@ define_request_and_response! {
|
||||||
to_height: u64 = default_zero::<u64>(), "default_zero",
|
to_height: u64 = default_zero::<u64>(), "default_zero",
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: enable test after binary string impl.
|
#[doc = serde_doc_test!(
|
||||||
// #[doc = serde_doc_test!(
|
GET_OUTPUT_DISTRIBUTION_RESPONSE => GetOutputDistributionResponse {
|
||||||
// GET_OUTPUT_DISTRIBUTION_RESPONSE => GetOutputDistributionResponse {
|
base: AccessResponseBase::OK,
|
||||||
// base: AccessResponseBase::OK,
|
distributions: vec![Distribution::Uncompressed(DistributionUncompressed {
|
||||||
// distributions: vec![Distribution::Uncompressed(DistributionUncompressed {
|
start_height: 1462078,
|
||||||
// start_height: 1462078,
|
base: 0,
|
||||||
// base: 0,
|
distribution: vec![],
|
||||||
// distribution: vec![],
|
amount: 2628780000,
|
||||||
// amount: 2628780000,
|
binary: true,
|
||||||
// binary: true,
|
})],
|
||||||
// })],
|
}
|
||||||
// }
|
)]
|
||||||
// )]
|
|
||||||
AccessResponseBase {
|
AccessResponseBase {
|
||||||
distributions: Vec<Distribution>,
|
distributions: Vec<Distribution>,
|
||||||
}
|
}
|
||||||
|
@ -1615,14 +1618,14 @@ pub enum JsonRpcRequest {
|
||||||
GetBans(GetBansRequest),
|
GetBans(GetBansRequest),
|
||||||
Banned(BannedRequest),
|
Banned(BannedRequest),
|
||||||
FlushTransactionPool(FlushTransactionPoolRequest),
|
FlushTransactionPool(FlushTransactionPoolRequest),
|
||||||
GetOutputHistogram(GetOutputHistogramRequest),
|
GetOutputHistogramV2(GetOutputHistogramV2Request),
|
||||||
GetCoinbaseTxSum(GetCoinbaseTxSumRequest),
|
GetCoinbaseTxSum(GetCoinbaseTxSumRequest),
|
||||||
GetVersion(GetVersionRequest),
|
GetVersion(GetVersionRequest),
|
||||||
GetFeeEstimate(GetFeeEstimateRequest),
|
GetFeeEstimate(GetFeeEstimateRequest),
|
||||||
GetAlternateChains(GetAlternateChainsRequest),
|
GetAlternateChains(GetAlternateChainsRequest),
|
||||||
RelayTx(RelayTxRequest),
|
RelayTx(RelayTxRequest),
|
||||||
SyncInfo(SyncInfoRequest),
|
SyncInfo(SyncInfoRequest),
|
||||||
GetTransactionPoolBacklog(GetTransactionPoolBacklogRequest),
|
GetTransactionPoolBacklogV2(GetTransactionPoolBacklogV2Request),
|
||||||
GetMinerData(GetMinerDataRequest),
|
GetMinerData(GetMinerDataRequest),
|
||||||
PruneBlockchain(PruneBlockchainRequest),
|
PruneBlockchain(PruneBlockchainRequest),
|
||||||
CalcPow(CalcPowRequest),
|
CalcPow(CalcPowRequest),
|
||||||
|
@ -1644,10 +1647,10 @@ impl RpcCallValue for JsonRpcRequest {
|
||||||
Self::GetBlock(x) => x.is_restricted(),
|
Self::GetBlock(x) => x.is_restricted(),
|
||||||
Self::GetInfo(x) => x.is_restricted(),
|
Self::GetInfo(x) => x.is_restricted(),
|
||||||
Self::HardForkInfo(x) => x.is_restricted(),
|
Self::HardForkInfo(x) => x.is_restricted(),
|
||||||
Self::GetOutputHistogram(x) => x.is_restricted(),
|
Self::GetOutputHistogramV2(x) => x.is_restricted(),
|
||||||
Self::GetVersion(x) => x.is_restricted(),
|
Self::GetVersion(x) => x.is_restricted(),
|
||||||
Self::GetFeeEstimate(x) => x.is_restricted(),
|
Self::GetFeeEstimate(x) => x.is_restricted(),
|
||||||
Self::GetTransactionPoolBacklog(x) => x.is_restricted(),
|
Self::GetTransactionPoolBacklogV2(x) => x.is_restricted(),
|
||||||
Self::GetMinerData(x) => x.is_restricted(),
|
Self::GetMinerData(x) => x.is_restricted(),
|
||||||
Self::AddAuxPow(x) => x.is_restricted(),
|
Self::AddAuxPow(x) => x.is_restricted(),
|
||||||
Self::GetTxIdsLoose(x) => x.is_restricted(),
|
Self::GetTxIdsLoose(x) => x.is_restricted(),
|
||||||
|
@ -1679,10 +1682,10 @@ impl RpcCallValue for JsonRpcRequest {
|
||||||
Self::GetBlock(x) => x.is_empty(),
|
Self::GetBlock(x) => x.is_empty(),
|
||||||
Self::GetInfo(x) => x.is_empty(),
|
Self::GetInfo(x) => x.is_empty(),
|
||||||
Self::HardForkInfo(x) => x.is_empty(),
|
Self::HardForkInfo(x) => x.is_empty(),
|
||||||
Self::GetOutputHistogram(x) => x.is_empty(),
|
Self::GetOutputHistogramV2(x) => x.is_empty(),
|
||||||
Self::GetVersion(x) => x.is_empty(),
|
Self::GetVersion(x) => x.is_empty(),
|
||||||
Self::GetFeeEstimate(x) => x.is_empty(),
|
Self::GetFeeEstimate(x) => x.is_empty(),
|
||||||
Self::GetTransactionPoolBacklog(x) => x.is_empty(),
|
Self::GetTransactionPoolBacklogV2(x) => x.is_empty(),
|
||||||
Self::GetMinerData(x) => x.is_empty(),
|
Self::GetMinerData(x) => x.is_empty(),
|
||||||
Self::AddAuxPow(x) => x.is_empty(),
|
Self::AddAuxPow(x) => x.is_empty(),
|
||||||
Self::GetTxIdsLoose(x) => x.is_empty(),
|
Self::GetTxIdsLoose(x) => x.is_empty(),
|
||||||
|
@ -1747,14 +1750,14 @@ pub enum JsonRpcResponse {
|
||||||
GetBans(GetBansResponse),
|
GetBans(GetBansResponse),
|
||||||
Banned(BannedResponse),
|
Banned(BannedResponse),
|
||||||
FlushTransactionPool(FlushTransactionPoolResponse),
|
FlushTransactionPool(FlushTransactionPoolResponse),
|
||||||
GetOutputHistogram(GetOutputHistogramResponse),
|
GetOutputHistogramV2(GetOutputHistogramV2Response),
|
||||||
GetCoinbaseTxSum(GetCoinbaseTxSumResponse),
|
GetCoinbaseTxSum(GetCoinbaseTxSumResponse),
|
||||||
GetVersion(GetVersionResponse),
|
GetVersion(GetVersionResponse),
|
||||||
GetFeeEstimate(GetFeeEstimateResponse),
|
GetFeeEstimate(GetFeeEstimateResponse),
|
||||||
GetAlternateChains(GetAlternateChainsResponse),
|
GetAlternateChains(GetAlternateChainsResponse),
|
||||||
RelayTx(RelayTxResponse),
|
RelayTx(RelayTxResponse),
|
||||||
SyncInfo(SyncInfoResponse),
|
SyncInfo(SyncInfoResponse),
|
||||||
GetTransactionPoolBacklog(GetTransactionPoolBacklogResponse),
|
GetTransactionPoolBacklogV2(GetTransactionPoolBacklogV2Response),
|
||||||
GetMinerData(GetMinerDataResponse),
|
GetMinerData(GetMinerDataResponse),
|
||||||
PruneBlockchain(PruneBlockchainResponse),
|
PruneBlockchain(PruneBlockchainResponse),
|
||||||
CalcPow(CalcPowResponse),
|
CalcPow(CalcPowResponse),
|
||||||
|
|
|
@ -1069,31 +1069,36 @@ r#"{
|
||||||
}"#;
|
}"#;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: binary string.
|
define_request_and_response! {
|
||||||
// define_request_and_response! {
|
get_txpool_backlog_v2 (json_rpc),
|
||||||
// get_txpool_backlog (json_rpc),
|
GET_TRANSACTION_POOL_BACKLOG_V2: &str,
|
||||||
// GET_TRANSACTION_POOL_BACKLOG: &str,
|
Request =
|
||||||
// Request =
|
r#"{
|
||||||
// r#"{
|
"jsonrpc": "2.0",
|
||||||
// "jsonrpc": "2.0",
|
"id": "0",
|
||||||
// "id": "0",
|
"method": "get_txpool_backlog_v2"
|
||||||
// "method": "get_txpool_backlog"
|
}"#;
|
||||||
// }"#;
|
Response =
|
||||||
// Response =
|
r#"{
|
||||||
// r#"{
|
"id": "0",
|
||||||
// "id": "0",
|
"jsonrpc": "2.0",
|
||||||
// "jsonrpc": "2.0",
|
"result": {
|
||||||
// "result": {
|
"backlog": [
|
||||||
// "backlog": "...Binary...",
|
{
|
||||||
// "status": "OK",
|
weight: 0,
|
||||||
// "untrusted": false
|
fee: 0,
|
||||||
// }
|
time_in_pool: 0,
|
||||||
// }"#;
|
}
|
||||||
// }
|
],
|
||||||
|
"status": "OK",
|
||||||
|
"untrusted": false
|
||||||
|
}
|
||||||
|
}"#;
|
||||||
|
}
|
||||||
|
|
||||||
define_request_and_response! {
|
define_request_and_response! {
|
||||||
get_output_distribution (json_rpc),
|
get_output_distribution_v2 (json_rpc),
|
||||||
GET_OUTPUT_DISTRIBUTION: &str,
|
GET_OUTPUT_DISTRIBUTION_V2: &str,
|
||||||
Request =
|
Request =
|
||||||
r#"{
|
r#"{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
|
|
Loading…
Reference in a new issue