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
|
@ -124,6 +124,12 @@ impl ChainStore for ChainKVStore {
|
|||
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> {
|
||||
let header_at_height = self.get_header_by_height(header.height)?;
|
||||
if header.hash() == header_at_height.hash() {
|
||||
|
|
|
@ -228,6 +228,10 @@ pub trait ChainStore: Send + Sync {
|
|||
/// Save the provided block in store
|
||||
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
|
||||
fn save_block_header(&self, bh: &BlockHeader) -> Result<(), store::Error>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue