2018-06-05 10:41:32 +00:00
|
|
|
extern crate electrs;
|
|
|
|
extern crate error_chain;
|
|
|
|
|
2018-06-25 19:16:22 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
|
2018-06-26 19:54:47 +00:00
|
|
|
use electrs::{config::Config, daemon::Daemon, errors::*, fake::FakeStore, index::Index,
|
|
|
|
metrics::Metrics, signal::Waiter};
|
2018-06-09 15:22:30 +00:00
|
|
|
use error_chain::ChainedError;
|
2018-06-05 10:41:32 +00:00
|
|
|
|
|
|
|
fn run() -> Result<()> {
|
2018-06-12 15:51:45 +00:00
|
|
|
let signal = Waiter::new();
|
2018-06-05 10:41:32 +00:00
|
|
|
let config = Config::from_args();
|
2018-06-12 15:51:45 +00:00
|
|
|
let metrics = Metrics::new(config.monitoring_addr);
|
2018-06-13 09:40:21 +00:00
|
|
|
metrics.start();
|
|
|
|
|
2018-06-12 18:52:00 +00:00
|
|
|
let daemon = Daemon::new(config.network_type, &metrics)?;
|
2018-06-05 10:41:32 +00:00
|
|
|
let fake_store = FakeStore {};
|
2018-06-14 08:56:47 +00:00
|
|
|
let index = Index::load(&fake_store, &daemon, &metrics)?;
|
|
|
|
index.update(&fake_store, &signal)?;
|
2018-06-05 10:41:32 +00:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if let Err(e) = run() {
|
2018-06-25 19:16:22 +00:00
|
|
|
error!("{}", e.display_chain());
|
2018-06-05 10:41:32 +00:00
|
|
|
}
|
|
|
|
}
|