mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Block deletion, to be used for pruning
This commit is contained in:
parent
8bdf0be73e
commit
b82fa0ea1d
2 changed files with 10 additions and 0 deletions
|
@ -123,6 +123,12 @@ impl ChainStore for ChainKVStore {
|
||||||
)?;
|
)?;
|
||||||
batch.write()
|
batch.write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete a full block. Does not delete any record associated with a block
|
||||||
|
/// header.
|
||||||
|
fn delete_block(&self, bh: &Hash) -> Result<(), Error> {
|
||||||
|
self.db.delete(&to_key(BLOCK_PREFIX, &mut bh.to_vec())[..])
|
||||||
|
}
|
||||||
|
|
||||||
fn is_on_current_chain(&self, header: &BlockHeader) -> Result<(), Error> {
|
fn is_on_current_chain(&self, header: &BlockHeader) -> Result<(), Error> {
|
||||||
let header_at_height = self.get_header_by_height(header.height)?;
|
let header_at_height = self.get_header_by_height(header.height)?;
|
||||||
|
|
|
@ -228,6 +228,10 @@ pub trait ChainStore: Send + Sync {
|
||||||
/// Save the provided block in store
|
/// Save the provided block in store
|
||||||
fn save_block(&self, b: &Block) -> Result<(), store::Error>;
|
fn save_block(&self, b: &Block) -> Result<(), store::Error>;
|
||||||
|
|
||||||
|
/// Delete a full block. Does not delete any record associated with a block
|
||||||
|
/// header.
|
||||||
|
fn delete_block(&self, bh: &Hash) -> Result<(), store::Error>;
|
||||||
|
|
||||||
/// Save the provided block header in store
|
/// Save the provided block header in store
|
||||||
fn save_block_header(&self, bh: &BlockHeader) -> Result<(), store::Error>;
|
fn save_block_header(&self, bh: &BlockHeader) -> Result<(), store::Error>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue