put_block modification

This commit is contained in:
Rostyslav Tyshko 2024-12-09 03:59:23 +01:00
parent 0674349de9
commit ffc37debb4
2 changed files with 5 additions and 3 deletions

View File

@ -31,6 +31,6 @@ impl SequecerBlockStore {
}
pub fn put_block_at_id(&self, block: Block) -> Result<()> {
Ok(self.dbio.put_block(block)?)
Ok(self.dbio.put_block(block, false)?)
}
}

View File

@ -149,7 +149,7 @@ impl RocksDBIO {
)
.map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))?;
self.put_block(block)?;
self.put_block(block, true)?;
Ok(())
}
@ -173,13 +173,15 @@ impl RocksDBIO {
Ok(())
}
pub fn put_block(&self, block: Block) -> DbResult<()> {
pub fn put_block(&self, block: Block, first: bool) -> DbResult<()> {
let cf_block = self.block_column();
if !first {
let last_curr_block = self.get_meta_last_block_in_db()?;
if block.block_id > last_curr_block {
self.put_meta_last_block_in_db(block.block_id)?;
}
}
self.db