blockchain/indexers: proper handling of empty filters

This commit is contained in:
Olaoluwa Osuntokun 2017-04-27 21:48:53 -07:00
parent e0943a84bd
commit 9b9ef42f8a

View file

@ -182,7 +182,11 @@ func storeFilter(dbTx database.Tx, block *btcutil.Block, f *gcs.Filter,
// Start by storing the filter.
h := block.Hash()
err := dbStoreFilter(dbTx, fkey, h, f.NBytes())
var basicFilterBytes []byte
if f != nil {
basicFilterBytes = f.NBytes()
}
err := dbStoreFilter(dbTx, fkey, h, basicFilterBytes)
if err != nil {
return err
}
@ -210,7 +214,7 @@ func (idx *CfIndex) ConnectBlock(dbTx database.Tx, block *btcutil.Block,
view *blockchain.UtxoViewpoint) error {
f, err := builder.BuildBasicFilter(block.MsgBlock())
if err != nil {
if err != nil && err != gcs.ErrNoData {
return err
}