Implement DisconnectBlock() for the CBF Indexer
This commit is contained in:
parent
618306116b
commit
8b8c7bcf05
1 changed files with 9 additions and 2 deletions
|
@ -152,8 +152,15 @@ func (idx *CBFIndex) ConnectBlock(dbTx database.Tx, block *btcutil.Block,
|
|||
// mapping for every passed block.
|
||||
//
|
||||
// This is part of the Indexer interface.
|
||||
func (idx *CBFIndex) DisconnectBlock(dbTx database.Tx, block *btcutil.Block, view *blockchain.UtxoViewpoint) error {
|
||||
return nil
|
||||
func (idx *CBFIndex) DisconnectBlock(dbTx database.Tx, block *btcutil.Block,
|
||||
view *blockchain.UtxoViewpoint) error {
|
||||
index := dbTx.Metadata().Bucket(cbfIndexKey)
|
||||
filterBytes := index.Get(block.Hash().CloneBytes())
|
||||
if len(filterBytes) == 0 {
|
||||
return fmt.Errorf("can't remove non-existent filter %s from " +
|
||||
"the cbfilter index", block.Hash())
|
||||
}
|
||||
return index.Delete(block.Hash().CloneBytes())
|
||||
}
|
||||
|
||||
func (idx *CBFIndex) GetFilterByBlockHash(hash *chainhash.Hash) ([]byte,
|
||||
|
|
Loading…
Reference in a new issue