code: func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
  	var (
  		pendingTxs   = make(chan []common.Hash)
  		pendingTxSub = api.events.SubscribePendingTxs(pendingTxs)
  	)
  
  	api.filtersMu.Lock()
  	api.filters[pendingTxSub.ID] = &filter{typ: PendingTransactionsSubscription, deadline: time.NewTimer(deadline), hashes: make([]common.Hash, 0), s: pendingTxSub}
  	api.filtersMu.Unlock()
  
  	go func() {
  		for {
  			select {
  			case ph := <-pendingTxs:
  				api.filtersMu.Lock()
  				if f, found := api.filters[pendingTxSub.ID]; found {
  					f.hashes = append(f.hashes, ph...)
  				}
  				api.filtersMu.Unlock()
  			case <-pendingTxSub.Err():
  				api.filtersMu.Lock()
  				delete(api.filters, pendingTxSub.ID)
  				api.filtersMu.Unlock()
  				return
  			}
  		}
  	}()
  
  	return pendingTxSub.ID
  }
docs: // NewPendingTransactionFilter creates a filter that fetches pending transaction hashes
  // as transactions enter the pending state.
  //
  // It is part of the filter package because this filter can be used through the
  // `eth_getFilterChanges` polling method that is also used for log filters.
  //
  // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter