mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-11 13:25:09 +00:00
get_output_histogram
This commit is contained in:
parent
6af977f0a5
commit
1a76934aac
1 changed files with 22 additions and 3 deletions
|
@ -38,7 +38,7 @@ use cuprate_rpc_types::{
|
||||||
SetBansRequest, SetBansResponse, SubmitBlockRequest, SubmitBlockResponse, SyncInfoRequest,
|
SetBansRequest, SetBansResponse, SubmitBlockRequest, SubmitBlockResponse, SyncInfoRequest,
|
||||||
SyncInfoResponse,
|
SyncInfoResponse,
|
||||||
},
|
},
|
||||||
misc::{BlockHeader, GetBan, Status},
|
misc::{BlockHeader, GetBan, HistogramEntry, Status},
|
||||||
CORE_RPC_VERSION,
|
CORE_RPC_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -512,12 +512,31 @@ async fn flush_transaction_pool(
|
||||||
|
|
||||||
/// <https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.cpp#L2934-L2979>
|
/// <https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.cpp#L2934-L2979>
|
||||||
async fn get_output_histogram(
|
async fn get_output_histogram(
|
||||||
state: CupratedRpcHandler,
|
mut state: CupratedRpcHandler,
|
||||||
request: GetOutputHistogramRequest,
|
request: GetOutputHistogramRequest,
|
||||||
) -> Result<GetOutputHistogramResponse, Error> {
|
) -> Result<GetOutputHistogramResponse, Error> {
|
||||||
|
let input = cuprate_types::OutputHistogramInput {
|
||||||
|
amounts: request.amounts,
|
||||||
|
min_count: request.min_count,
|
||||||
|
max_count: request.max_count,
|
||||||
|
unlocked: request.unlocked,
|
||||||
|
recent_cutoff: request.recent_cutoff,
|
||||||
|
};
|
||||||
|
|
||||||
|
let histogram = blockchain::output_histogram(&mut state.blockchain_read, input)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| HistogramEntry {
|
||||||
|
amount: entry.amount,
|
||||||
|
total_instances: entry.total_instances,
|
||||||
|
unlocked_instances: entry.unlocked_instances,
|
||||||
|
recent_instances: entry.recent_instances,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(GetOutputHistogramResponse {
|
Ok(GetOutputHistogramResponse {
|
||||||
base: AccessResponseBase::ok(),
|
base: AccessResponseBase::ok(),
|
||||||
histogram: todo!(),
|
histogram,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue