Skip to content
Snippets Groups Projects
Commit 606cca62 authored by Éloïs's avatar Éloïs
Browse files

[fix]: fill current meta db on start

parent 162ffdfb
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2020 Éloïs SANCHEZ.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::*;
use duniter_dbs::databases::bc_v2::BcV2DbReadable;
pub(super) fn fill_current_meta_db(shared_dbs: &SharedDbs<FileBackend>) -> anyhow::Result<()> {
if let Some(current_block_meta) = shared_dbs
.bc_db_ro
.blocks_meta()
.iter_rev(.., |it| it.values().next_res())?
{
shared_dbs
.cm_db
.current_block_meta_write()
.upsert((), current_block_meta)?;
}
Ok(())
}
......@@ -22,6 +22,7 @@
unused_import_braces
)]
mod fill_cm_db;
mod legacy;
pub use duniter_conf::{gva_conf::GvaConf, DuniterConf, DuniterMode};
......@@ -119,6 +120,9 @@ impl DuniterServer {
let threadpool =
fast_threadpool::ThreadPool::start(ThreadPoolConfig::default(), shared_dbs.clone());
// Fill CmV1Db
fill_cm_db::fill_current_meta_db(&shared_dbs)?;
if conf.gva.is_some() {
log::info!("start duniter modules...");
let runtime = tokio::runtime::Builder::new_multi_thread()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment