backup commit
This commit is contained in:
@@ -32,6 +32,8 @@ pub struct ElectrsSyncStatus {
|
||||
pub error: Option<String>,
|
||||
/// Index data size in human-readable format (e.g. "11.2 GB")
|
||||
pub index_size: Option<String>,
|
||||
/// Tor onion address for ElectrumX (if available)
|
||||
pub tor_onion: Option<String>,
|
||||
}
|
||||
|
||||
/// Get the total size of a directory in bytes.
|
||||
@@ -146,6 +148,14 @@ pub async fn get_electrs_sync_status() -> ElectrsSyncStatus {
|
||||
None
|
||||
};
|
||||
|
||||
// Read Tor onion address if available
|
||||
let tor_onion = tokio::fs::read_to_string(
|
||||
"/var/lib/archipelago/tor/hidden_service_electrs/hostname",
|
||||
)
|
||||
.await
|
||||
.ok()
|
||||
.map(|s| s.trim().to_string());
|
||||
|
||||
let network_height = match bitcoin_network_height().await {
|
||||
Ok(h) => h,
|
||||
Err(e) => {
|
||||
@@ -156,6 +166,7 @@ pub async fn get_electrs_sync_status() -> ElectrsSyncStatus {
|
||||
status: "error".to_string(),
|
||||
error: Some(format!("Bitcoin RPC: {}", e)),
|
||||
index_size,
|
||||
tor_onion,
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -196,6 +207,7 @@ pub async fn get_electrs_sync_status() -> ElectrsSyncStatus {
|
||||
status,
|
||||
error,
|
||||
index_size,
|
||||
tor_onion: tor_onion.clone(),
|
||||
};
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -206,6 +218,7 @@ pub async fn get_electrs_sync_status() -> ElectrsSyncStatus {
|
||||
status: "error".to_string(),
|
||||
error: Some(format!("Task: {}", e)),
|
||||
index_size,
|
||||
tor_onion: tor_onion.clone(),
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -229,5 +242,6 @@ pub async fn get_electrs_sync_status() -> ElectrsSyncStatus {
|
||||
status: status.to_string(),
|
||||
error: None,
|
||||
index_size,
|
||||
tor_onion,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user