code: func notifyBlockWithFilter(chain ChainSource, ro *rescanOptions,
  	curHeader *wire.BlockHeader, curStamp *waddrmgr.BlockStamp,
  	filter *gcs.Filter) error {
  
  	// Based on what we find within the block or the filter, we'll be
  	// sending out a set of notifications with transactions that are
  	// relevant to the rescan.
  	var relevantTxs []*btcutil.Tx
  
  	// If we actually have a filter, then we'll go ahead an attempt to
  	// match the items within the filter to ensure we create any relevant
  	// notifications.
  	if filter != nil {
  		matched, err := matchBlockFilter(ro, filter, &curStamp.Hash)
  		if err != nil {
  			return err
  		}
  
  		if matched {
  			relevantTxs, err = extractBlockMatches(
  				chain, ro, curStamp,
  			)
  			if err != nil {
  				return err
  			}
  		}
  	}
  
  	if ro.ntfn.OnFilteredBlockConnected != nil {
  		ro.ntfn.OnFilteredBlockConnected(curStamp.Height, curHeader,
  			relevantTxs)
  	}
  
  	if ro.ntfn.OnBlockConnected != nil {
  		ro.ntfn.OnBlockConnected(&curStamp.Hash,
  			curStamp.Height, curHeader.Timestamp)
  	}
  
  	return nil
  }
docs: // notifyBlockWithFilter calls appropriate listeners based on the block filter.
  // This differs from notifyBlock in that is expects the caller to already have
  // obtained the target filter.