celestia_types/sync.rs
1use serde::{Deserialize, Serialize};
2use tendermint::time::Time;
3
4use crate::hash::Hash;
5
6/// A state of the blockchain synchronization.
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8pub struct SyncState {
9 /// The ID of the current syncing process.
10 pub id: u64,
11 /// Currently synced height.
12 pub height: u64,
13 /// The first height to be synced.
14 pub from_height: u64,
15 /// The last height to be synced.
16 pub to_height: u64,
17 /// The first hash to be synced.
18 #[serde(with = "crate::serializers::hash")]
19 pub from_hash: Hash,
20 /// The last hash to be synced.
21 #[serde(with = "crate::serializers::hash")]
22 pub to_hash: Hash,
23 /// The time when syncing began.
24 pub start: Time,
25 /// The time when syncing ended.
26 pub end: Time,
27 /// Any error during synchronisation, if it occured
28 pub error: Option<String>,
29}