mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Use regular indexing instead of the bulk-based one (with disabled compaction)
This commit is contained in:
parent
972a155ce0
commit
0b4a56ade8
@ -18,6 +18,7 @@ impl App {
|
||||
index: index::Index,
|
||||
daemon: daemon::Daemon,
|
||||
) -> Result<Arc<App>> {
|
||||
index.reload(&store);
|
||||
Ok(Arc::new(App {
|
||||
store,
|
||||
index,
|
||||
|
@ -28,12 +28,14 @@ fn run_server(config: &Config) -> Result<()> {
|
||||
)?;
|
||||
// Perform initial indexing from local blk*.dat block files.
|
||||
let store = DBStore::open(&config.db_path);
|
||||
let index = Index::load(&store, &daemon, &metrics)?;
|
||||
let store = if config.skip_bulk_import {
|
||||
index.update(&store, &signal)?;
|
||||
bulk::skip(store)
|
||||
} else {
|
||||
bulk::index(&daemon, &metrics, store)
|
||||
}?;
|
||||
let index = Index::load(&store, &daemon, &metrics)?;
|
||||
|
||||
let app = App::new(store, index, daemon)?;
|
||||
let query = Query::new(app.clone(), &metrics);
|
||||
|
||||
|
@ -318,6 +318,11 @@ impl Index {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn reload(&self, store: &ReadStore) {
|
||||
let mut headers = self.headers.write().unwrap();
|
||||
*headers = read_indexed_headers(store);
|
||||
}
|
||||
|
||||
pub fn best_header(&self) -> Option<HeaderEntry> {
|
||||
let headers = self.headers.read().unwrap();
|
||||
headers.header_by_blockhash(headers.tip()).cloned()
|
||||
|
Loading…
Reference in New Issue
Block a user