Skip to content

Commit

Permalink
feat: return current_state as a string instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-zil committed Feb 5, 2025
1 parent d951649 commit 57c0a6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion zilliqa/src/api/types/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ pub struct TxPoolContent {
#[derive(Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SyncingMeta {
pub current_phase: u8,
pub current_phase: String,
pub peer_count: usize,
pub header_downloads: u64,
pub block_downloads: u64,
Expand Down
10 changes: 8 additions & 2 deletions zilliqa/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,14 @@ enum SyncState {
}

impl SyncState {
fn discriminant(&self) -> u8 {
unsafe { *<*const _>::from(self).cast::<u8>() }
fn discriminant(&self) -> String {
match self {
SyncState::Phase0 => "phase0".to_string(),
SyncState::Phase1(_) => "phase1".to_string(),
SyncState::Phase2(_) => "phase2".to_string(),
SyncState::Phase3 => "phase3".to_string(),
SyncState::Retry1 => "retry1".to_string(),
}
}
}

Expand Down

0 comments on commit 57c0a6b

Please sign in to comment.