2023-04-15 21:38:47 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_mut)]
|
|
|
|
|
|
|
|
use serai_db::Db;
|
|
|
|
|
|
|
|
use serai_client::Serai;
|
|
|
|
|
2023-04-11 23:04:53 +00:00
|
|
|
mod transaction;
|
2023-04-15 21:38:47 +00:00
|
|
|
mod substrate;
|
2023-04-11 23:04:53 +00:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
|
2023-04-15 21:38:47 +00:00
|
|
|
async fn run<D: Db>(db: D, serai: Serai) {
|
|
|
|
let mut last_substrate_block = 0; // TODO: Load from DB
|
|
|
|
|
|
|
|
loop {
|
|
|
|
match substrate::handle_new_blocks(&serai, &mut last_substrate_block).await {
|
|
|
|
Ok(()) => {}
|
|
|
|
Err(e) => log::error!("couldn't communicate with serai node: {e}"),
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle all messages from tributaries
|
|
|
|
|
|
|
|
// Handle all messages from processors
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-11 13:21:35 +00:00
|
|
|
#[tokio::main]
|
2023-04-15 21:38:47 +00:00
|
|
|
async fn main() {
|
|
|
|
// Open the database
|
|
|
|
}
|