2024-09-12 18:40:10 -04:00
|
|
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
|
|
|
|
#![doc = include_str!("../README.md")]
|
|
|
|
|
#![deny(missing_docs)]
|
|
|
|
|
|
|
|
|
|
#[global_allocator]
|
|
|
|
|
static ALLOCATOR: zalloc::ZeroizingAlloc<std::alloc::System> =
|
|
|
|
|
zalloc::ZeroizingAlloc(std::alloc::System);
|
|
|
|
|
|
2024-09-14 01:38:31 -04:00
|
|
|
use monero_simple_request_rpc::SimpleRequestRpc;
|
2024-09-12 18:40:10 -04:00
|
|
|
|
|
|
|
|
mod primitives;
|
|
|
|
|
pub(crate) use crate::primitives::*;
|
|
|
|
|
|
|
|
|
|
mod key_gen;
|
|
|
|
|
use crate::key_gen::KeyGenParams;
|
|
|
|
|
mod rpc;
|
|
|
|
|
use rpc::Rpc;
|
|
|
|
|
mod scheduler;
|
2024-09-14 01:38:31 -04:00
|
|
|
use scheduler::{Planner, Scheduler};
|
2024-09-12 18:40:10 -04:00
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
|
async fn main() {
|
|
|
|
|
let db = bin::init();
|
|
|
|
|
let feed = Rpc {
|
|
|
|
|
rpc: loop {
|
2024-09-14 01:38:31 -04:00
|
|
|
match SimpleRequestRpc::new(bin::url()).await {
|
2024-09-12 18:40:10 -04:00
|
|
|
Ok(rpc) => break rpc,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
log::error!("couldn't connect to the Monero node: {e:?}");
|
|
|
|
|
tokio::time::sleep(core::time::Duration::from_secs(5)).await;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-14 01:38:31 -04:00
|
|
|
bin::main_loop::<_, KeyGenParams, _>(
|
|
|
|
|
db,
|
|
|
|
|
feed.clone(),
|
|
|
|
|
Scheduler::new(Planner(feed.clone())),
|
|
|
|
|
feed,
|
|
|
|
|
)
|
|
|
|
|
.await;
|
2024-09-12 18:40:10 -04:00
|
|
|
}
|