fix panick on startup if node is not fully synced

This commit is contained in:
aglkm
2024-10-29 17:16:53 +03:00
parent 94d8a26081
commit 21ed028ade
2 changed files with 7 additions and 3 deletions

View File

@@ -151,8 +151,10 @@ pub async fn get_status(dashboard: Arc<Mutex<Dashboard>>) -> Result<(), anyhow::
let mut data = dashboard.lock().unwrap();
if resp2 != Value::Null {
if resp2["result"]["Ok"]["header"]["kernel_mmr_size"] != Value::Null {
data.kernel_mmr_size = resp2["result"]["Ok"]["header"]["kernel_mmr_size"].to_string();
}
}
if resp1["result"]["Ok"]["chain"] == Value::Null {
if data.chain.is_empty() {

View File

@@ -47,8 +47,10 @@ pub async fn stats(dash: Arc<Mutex<Dashboard>>, txns: Arc<Mutex<Transactions>>,
stats.fees.push(txns.fees_24h.clone());
stats.utxo_count.push(dash.utxo_count.clone());
if dash.kernel_mmr_size.is_empty() == false {
let kernel_count = dash.kernel_mmr_size.parse::<u64>().unwrap() / 2;
stats.kernels.push(kernel_count.to_string());
}
Ok(())
}