blockstream-electrs/examples/index.rs
Roman Zeyde 2d74d6d4f0
Rename a few Config members following #19
rpc_addr -> electrum_rpc_addr
daemon_rpc_url -> daemon_rpc_addr
2018-07-15 22:39:19 +03:00

37 lines
830 B
Rust

extern crate electrs;
extern crate error_chain;
#[macro_use]
extern crate log;
use electrs::{
config::Config, daemon::Daemon, errors::*, fake::FakeStore, index::Index, metrics::Metrics,
signal::Waiter,
};
use error_chain::ChainedError;
fn run() -> Result<()> {
let signal = Waiter::new();
let config = Config::from_args();
let metrics = Metrics::new(config.monitoring_addr);
metrics.start();
let daemon = Daemon::new(
&config.daemon_dir,
config.daemon_rpc_addr,
&config.cookie,
config.network_type,
&metrics,
)?;
let fake_store = FakeStore {};
let index = Index::load(&fake_store, &daemon, &metrics)?;
index.update(&fake_store, &signal)?;
Ok(())
}
fn main() {
if let Err(e) = run() {
error!("{}", e.display_chain());
}
}