diff --git a/src/bin/main.rs b/src/bin/main.rs index 0789275..e55e3c2 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -19,10 +19,11 @@ use electrs::{app::App, fn run_server(config: &Config) -> Result<()> { let signal = Waiter::new(); let metrics = Metrics::new(config.monitoring_addr); + metrics.start(); + let daemon = Daemon::new(config.network_type, &metrics)?; let store = DBStore::open(&config.db_path, StoreOptions { bulk_import: true }); let index = Index::load(&store, &metrics); - metrics.start(); let mut tip = index.update(&store, &daemon, &signal)?; store.compact_if_needed(); @@ -32,6 +33,8 @@ fn run_server(config: &Config) -> Result<()> { let app = App::new(store, index, daemon); let query = Query::new(app.clone(), &metrics); + query.update_mempool()?; // poll once before starting RPC server + let rpc = RPC::start(config.rpc_addr, query.clone(), &metrics); while let None = signal.wait(Duration::from_secs(5)) { query.update_mempool()?;