This commit is contained in:
hinto.janai 2024-11-25 19:18:20 -05:00
parent 7c7f64101f
commit 4f3b943b12
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
7 changed files with 13 additions and 17 deletions

View file

@ -9,8 +9,7 @@ use cuprate_rpc_types::{
bin::{ bin::{
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksRequest, GetHashesRequest, BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksRequest, GetHashesRequest,
GetOutputDistributionRequest, GetOutputIndexesRequest, GetOutsRequest, GetOutputDistributionRequest, GetOutputIndexesRequest, GetOutsRequest,
GetTransactionPoolBacklogRequest, GetTransactionPoolBacklogResponse, GetTransactionPoolBacklogRequest, GetTransactionPoolHashesRequest,
GetTransactionPoolHashesRequest,
}, },
RpcCall, RpcCall,
}; };

View file

@ -181,6 +181,7 @@ generate_router_builder! {
bin_get_o_indexes => "/get_o_indexes.bin" => bin::get_o_indexes => (get, post), bin_get_o_indexes => "/get_o_indexes.bin" => bin::get_o_indexes => (get, post),
bin_get_outs => "/get_outs.bin" => bin::get_outs => (get, post), bin_get_outs => "/get_outs.bin" => bin::get_outs => (get, post),
bin_get_transaction_pool_hashes => "/get_transaction_pool_hashes.bin" => bin::get_transaction_pool_hashes => (get, post), bin_get_transaction_pool_hashes => "/get_transaction_pool_hashes.bin" => bin::get_transaction_pool_hashes => (get, post),
bin_get_txpool_backlog => "/get_txpool_backlog.bin" => bin::get_txpool_backlog => (get, post),
bin_get_output_distribution => "/get_output_distribution.bin" => bin::get_output_distribution => (get, post), bin_get_output_distribution => "/get_output_distribution.bin" => bin::get_output_distribution => (get, post),
} }

View file

@ -52,7 +52,7 @@ TODO: update after finalizing <https://github.com/monero-project/monero/issues/9
- [`crate::json::GetOutputDistributionV2Response`] - [`crate::json::GetOutputDistributionV2Response`]
# Optimized types # Optimized types
TODO: updated after deciding compatability <-> optimization tradeoff. TODO: updated after deciding compatibility <-> optimization tradeoff.
- Fixed byte containers - Fixed byte containers

View file

@ -1378,12 +1378,12 @@ define_request_and_response! {
}, },
#[doc = serde_doc_test!( #[doc = serde_doc_test!(
GET_OUTPUT_DISTRIBUTION_RESPONSE => GetOutputDistributionResponse { GET_OUTPUT_DISTRIBUTION_V2_RESPONSE => GetOutputDistributionV2Response {
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![0, 1, 2],
amount: 2628780000, amount: 2628780000,
binary: true, binary: true,
})], })],

View file

@ -44,7 +44,7 @@ fn decompress_integer_array(_: &[u8]) -> Vec<u64> {
"rpc/core_rpc_server_commands_defs.h", "rpc/core_rpc_server_commands_defs.h",
2468..=2508 2468..=2508
)] )]
/// Used in [`crate::json::GetOutputDistributionResponse`]. /// Used in [`crate::json::GetOutputDistributionV2Response`].
/// ///
/// # Internals /// # Internals
/// This type's (de)serialization depends on `monerod`'s (de)serialization. /// This type's (de)serialization depends on `monerod`'s (de)serialization.
@ -82,10 +82,8 @@ impl Default for Distribution {
pub struct DistributionUncompressed { pub struct DistributionUncompressed {
pub start_height: u64, pub start_height: u64,
pub base: u64, pub base: u64,
/// TODO: this is a binary JSON string if `binary == true`.
pub distribution: Vec<u64>, pub distribution: Vec<u64>,
pub amount: u64, pub amount: u64,
pub binary: bool,
} }
#[cfg(feature = "epee")] #[cfg(feature = "epee")]
@ -95,7 +93,6 @@ epee_object! {
base: u64, base: u64,
distribution: Vec<u64>, distribution: Vec<u64>,
amount: u64, amount: u64,
binary: bool,
} }
/// Data within [`Distribution::CompressedBinary`]. /// Data within [`Distribution::CompressedBinary`].
@ -212,10 +209,9 @@ impl EpeeObjectBuilder<Distribution> for __DistributionEpeeBuilder {
}) })
} else if let Some(distribution) = self.distribution { } else if let Some(distribution) = self.distribution {
Distribution::Uncompressed(DistributionUncompressed { Distribution::Uncompressed(DistributionUncompressed {
binary: self.binary.ok_or(ELSE)?,
distribution,
start_height, start_height,
base, base,
distribution,
amount, amount,
}) })
} else { } else {

View file

@ -178,7 +178,7 @@ define_struct_and_impl_epee! {
2139..=2156 2139..=2156
)] )]
#[derive(Copy)] #[derive(Copy)]
/// Used in [`crate::json::GetOutputHistogramResponse`]. /// Used in [`crate::json::GetOutputHistogramV2Response`].
HistogramEntry { HistogramEntry {
amount: u64, amount: u64,
total_instances: u64, total_instances: u64,
@ -257,7 +257,7 @@ define_struct_and_impl_epee! {
1637..=1642 1637..=1642
)] )]
#[derive(Copy)] #[derive(Copy)]
/// Used in [`crate::json::GetTransactionPoolBacklogResponse`]. /// Used in [`crate::json::GetTransactionPoolBacklogV2Response`].
TxBacklogEntry { TxBacklogEntry {
weight: u64, weight: u64,
fee: u64, fee: u64,
@ -271,7 +271,7 @@ define_struct_and_impl_epee! {
"rpc/rpc_handler.h", "rpc/rpc_handler.h",
45..=50 45..=50
)] )]
/// Used in [`crate::json::GetOutputDistributionResponse`]. /// Used in [`crate::json::GetOutputDistributionV2Response`].
OutputDistributionData { OutputDistributionData {
distribution: Vec<u64>, distribution: Vec<u64>,
start_height: u64, start_height: u64,

View file

@ -1085,9 +1085,9 @@ r#"{
"result": { "result": {
"backlog": [ "backlog": [
{ {
weight: 0, "weight": 0,
fee: 0, "fee": 0,
time_in_pool: 0, "time_in_pool": 0
} }
], ],
"status": "OK", "status": "OK",