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

[fix] blockchain: remove fork_blocks only if not already removed

parent cb1d076a
Branches
No related tags found
1 merge request!193Resolve "Migrate high-volume DBs to LMDB"
......@@ -78,9 +78,14 @@ pub fn insert_new_head_block(
// Remove too old blocks
for blockstamp in removed_blockstamps {
let blockstamp_bytes: Vec<u8> = blockstamp.into();
if fork_blocks_store
.get(w.as_ref(), &blockstamp_bytes)?
.is_some()
{
fork_blocks_store.delete(w.as_mut(), &blockstamp_bytes)?;
}
}
}
Ok(())
}
......
......@@ -87,8 +87,13 @@ pub fn change_main_branch(
let fork_blocks_store = db.get_store(FORK_BLOCKS);
for blockstamp in removed_blockstamps {
let blockstamp_bytes: Vec<u8> = blockstamp.into();
if fork_blocks_store
.get(w.as_ref(), &blockstamp_bytes)?
.is_some()
{
fork_blocks_store.delete(w.as_mut(), &blockstamp_bytes)?;
}
}
Ok(())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment