Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Nov 27, 2024
1 parent 26cd6f2 commit 9ccfe86
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions blockindex/bloomfilterindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ func (bfx *bloomfilterIndexer) PutBlock(ctx context.Context, blk *block.Block) (
return nil
}

// DeleteTipBlock deletes tip height from underlying DB if necessary
func (bfx *bloomfilterIndexer) DeleteTipBlock(_ context.Context, blk *block.Block) (err error) {
bfx.mutex.Lock()
defer bfx.mutex.Unlock()
height := blk.Height()
if err := bfx.kvStore.Delete(BlockBloomFilterNamespace, byteutil.Uint64ToBytesBigEndian(height)); err != nil {
return err
}
bfx.curRangeBloomfilter = nil
return nil
}

// RangeBloomFilterNumElements returns the number of elements that each rangeBloomfilter indexes
func (bfx *bloomfilterIndexer) RangeBloomFilterNumElements() uint64 {
bfx.mutex.RLock()
Expand Down

0 comments on commit 9ccfe86

Please sign in to comment.