Have processor's Network::new sleep until booted, not panic

This commit is contained in:
Luke Parker
2023-11-08 01:25:20 -05:00
parent bc07e14b1e
commit a688350f44
3 changed files with 16 additions and 19 deletions

View File

@@ -192,7 +192,13 @@ fn map_rpc_err(err: RpcError) -> NetworkError {
impl Monero {
pub async fn new(url: String) -> Monero {
Monero { rpc: HttpRpc::new(url).await.unwrap() }
let mut res = HttpRpc::new(url.clone()).await;
while let Err(e) = res {
log::error!("couldn't connect to Monero node: {e:?}");
tokio::time::sleep(Duration::from_secs(5)).await;
res = HttpRpc::new(url.clone()).await;
}
Monero { rpc: res.unwrap() }
}
fn view_pair(spend: EdwardsPoint) -> ViewPair {