Skip to content

Commit

Permalink
NDEV-2183: Make EthSyncing fields public
Browse files Browse the repository at this point in the history
  • Loading branch information
Deniskore committed Sep 14, 2023
1 parent e7be346 commit c66db6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions evm_loader/lib/src/types/tracer_ch_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl EthSyncStatus {
#[derive(Row, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EthSyncing {
starting_block: u64,
current_block: u64,
highest_block: u64,
pub starting_block: u64,
pub current_block: u64,
pub highest_block: u64,
}
12 changes: 10 additions & 2 deletions evm_loader/lib/src/types/tracer_ch_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl ClickHouseDb {
}
}

pub async fn get_slot_by_blockhash(&self, blockhash: &str) -> ChResult<Option<u64>> {
pub async fn get_slot_by_blockhash(&self, blockhash: &str) -> ChResult<u64> {
let query = r#"SELECT slot
FROM events.notify_block_distributed
WHERE hash = ?
Expand All @@ -521,7 +521,15 @@ impl ClickHouseDb {
.await,
)?;

Ok(slot)
match slot {
Some(slot) => return Ok(slot),
None => {
let err = clickhouse::error::Error::Custom(format!(
"get_slot_by_blockhash: no data available",
));
return Err(ChError::Db(err));
}
}
}

pub async fn get_sync_status(&self) -> ChResult<EthSyncStatus> {
Expand Down

0 comments on commit c66db6e

Please sign in to comment.