mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-11-16 15:58:14 +00:00
json: add SyncInfo
This commit is contained in:
parent
255c5540aa
commit
32730272ea
3 changed files with 57 additions and 2 deletions
|
@ -8,7 +8,10 @@ use crate::{
|
|||
defaults::{default_bool, default_height, default_string, default_u64, default_vec},
|
||||
free::{is_one, is_zero},
|
||||
macros::define_request_and_response,
|
||||
misc::{BlockHeader, ChainInfo, ConnectionInfo, GetBan, HardforkEntry, HistogramEntry, SetBan},
|
||||
misc::{
|
||||
BlockHeader, ChainInfo, ConnectionInfo, GetBan, HardforkEntry, HistogramEntry, Peer,
|
||||
SetBan, Span,
|
||||
},
|
||||
Status,
|
||||
};
|
||||
|
||||
|
@ -511,6 +514,24 @@ define_request_and_response! {
|
|||
}
|
||||
}
|
||||
|
||||
define_request_and_response! {
|
||||
sync_info,
|
||||
cc73fe71162d564ffda8e549b79a350bca53c454 =>
|
||||
core_rpc_server_commands_defs.h => 2383..=2443,
|
||||
SyncInfo,
|
||||
Request {},
|
||||
Response {
|
||||
height: u64,
|
||||
next_needed_pruning_seed: u32,
|
||||
overview: String,
|
||||
// TODO: This is a `std::list` in `monerod` because...?
|
||||
peers: Vec<Peer>,
|
||||
// TODO: This is a `std::list` in `monerod` because...?
|
||||
spans: Vec<Span>,
|
||||
target_height: u64,
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Tests
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
|
|
@ -125,5 +125,5 @@ pub mod other;
|
|||
|
||||
mod misc;
|
||||
pub use misc::{
|
||||
BlockHeader, ChainInfo, ConnectionInfo, GetBan, HardforkEntry, HistogramEntry, SetBan,
|
||||
BlockHeader, ChainInfo, ConnectionInfo, GetBan, HardforkEntry, HistogramEntry, SetBan, Peer, Span,
|
||||
};
|
||||
|
|
|
@ -214,6 +214,40 @@ define_struct_and_impl_epee! {
|
|||
}
|
||||
}
|
||||
|
||||
define_struct_and_impl_epee! {
|
||||
#[doc = monero_definition_link!(
|
||||
cc73fe71162d564ffda8e549b79a350bca53c454,
|
||||
"rpc/core_rpc_server_commands_defs.h",
|
||||
2393..=2400
|
||||
)]
|
||||
/// Used in [`crate::json::SyncInfoResponse`].
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
Peer {
|
||||
info: ConnectionInfo,
|
||||
}
|
||||
}
|
||||
|
||||
define_struct_and_impl_epee! {
|
||||
#[doc = monero_definition_link!(
|
||||
cc73fe71162d564ffda8e549b79a350bca53c454,
|
||||
"rpc/core_rpc_server_commands_defs.h",
|
||||
2402..=2421
|
||||
)]
|
||||
/// Used in [`crate::json::SyncInfoResponse`].
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
Span {
|
||||
connection_id: String,
|
||||
nblocks: u64,
|
||||
rate: u32,
|
||||
remote_address: String,
|
||||
size: u64,
|
||||
speed: u32,
|
||||
start_block_height: u64,
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Tests
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
|
Loading…
Reference in a new issue