2018-06-05 13:41:32 +03:00
|
|
|
extern crate electrs;
|
|
|
|
extern crate error_chain;
|
|
|
|
|
|
|
|
use electrs::{config::Config,
|
|
|
|
daemon::Daemon,
|
|
|
|
errors::*,
|
|
|
|
index::Index,
|
|
|
|
store::{ReadStore, Row, WriteStore},
|
|
|
|
util::Bytes};
|
2018-06-09 18:22:30 +03:00
|
|
|
use error_chain::ChainedError;
|
2018-06-05 13:41:32 +03:00
|
|
|
|
|
|
|
struct FakeStore;
|
|
|
|
|
|
|
|
impl ReadStore for FakeStore {
|
|
|
|
fn get(&self, _key: &[u8]) -> Option<Bytes> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn scan(&self, _prefix: &[u8]) -> Vec<Row> {
|
|
|
|
vec![]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl WriteStore for FakeStore {
|
|
|
|
fn write(&self, _rows: Vec<Row>) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn run() -> Result<()> {
|
|
|
|
let config = Config::from_args();
|
|
|
|
let daemon = Daemon::new(config.network_type)?;
|
|
|
|
let fake_store = FakeStore {};
|
|
|
|
let index = Index::load(&fake_store);
|
2018-06-09 18:22:30 +03:00
|
|
|
index.update(&fake_store, &daemon)?;
|
2018-06-05 13:41:32 +03:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if let Err(e) = run() {
|
2018-06-09 18:22:30 +03:00
|
|
|
eprintln!("{}", e.display_chain());
|
2018-06-05 13:41:32 +03:00
|
|
|
}
|
|
|
|
}
|