code: func (m *txSortedMap) Filter(filter func(*types.Transaction) bool) types.Transactions {
  	var removed types.Transactions
  
  	// Collect all the transactions to filter out
  	for nonce, tx := range m.items {
  		if filter(tx) {
  			removed = append(removed, tx)
  			delete(m.items, nonce)
  		}
  	}
  	// If transactions were removed, the heap and cache are ruined
  	if len(removed) > 0 {
  		*m.index = make([]uint64, 0, len(m.items))
  		for nonce := range m.items {
  			*m.index = append(*m.index, nonce)
  		}
  		heap.Init(m.index)
  
  		m.cache = nil
  	}
  	return removed
  }
docs: // Filter iterates over the list of transactions and removes all of them for which
  // the specified function evaluates to true.