diff --git a/api/src/handlers/server_api.rs b/api/src/handlers/server_api.rs index 0a8479ea..a2746a4f 100644 --- a/api/src/handlers/server_api.rs +++ b/api/src/handlers/server_api.rs @@ -76,6 +76,7 @@ impl Handler for StatusHandler { /// Convert a SyncStatus in a readable API representation fn sync_status_to_api(sync_status: SyncStatus) -> (String, Option) { match sync_status { + SyncStatus::Initial => ("initial".to_string(), None), SyncStatus::NoSync => ("no_sync".to_string(), None), SyncStatus::AwaitingPeers(_) => ("awaiting_peers".to_string(), None), SyncStatus::HeaderSync { @@ -86,12 +87,42 @@ fn sync_status_to_api(sync_status: SyncStatus) -> (String, Option ( + "txhashsetpibd_download".to_string(), + Some(json!({ + "aborted": aborted, + "errored": errored, + "completed_leaves":completed_leaves, + "leaves_required":leaves_required, + "completed_to_height": completed_to_height, + "required_height":required_height})), + ), SyncStatus::TxHashsetDownload(stats) => ( "txhashset_download".to_string(), Some( json!({ "downloaded_size": stats.downloaded_size, "total_size": stats.total_size }), ), ), + SyncStatus::TxHashsetSetup { + headers, + headers_total, + kernel_pos, + kernel_pos_total, + } => ( + "txhashset_setup".to_string(), + Some(json!({ + "headers": headers, + "headers_total": headers_total, + "kernel_pos":kernel_pos, + "kernel_pos_total":kernel_pos_total})), + ), SyncStatus::TxHashsetRangeProofsValidation { rproofs, rproofs_total, @@ -106,6 +137,10 @@ fn sync_status_to_api(sync_status: SyncStatus) -> (String, Option ("txhashset_save".to_string(), None), + + SyncStatus::TxHashsetDone => ("txhashset_done".to_string(), None), + SyncStatus::BodySync { current_height, highest_height,