func (m *txSortedMap) Filter(filter func(*types.Transaction) bool) types.Transactions {
	removed := m.filter(filter)
	if len(removed) > 0 {
		m.reheap()
	}
	return removed
}
Filter iterates over the list of transactions and removes all of them for which
the specified function evaluates to true.
Filter, as opposed to 'filter', re-initialises the heap after the operation is done.
If you want to do several consecutive filterings, it's therefore better to first
do a .filter(func1) followed by .Filter(func2) or reheap()
package evmcore
import (
	"container/heap"
	"math"
	"math/big"
	"sort"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
)
type nonceHeap []uint64
func (h nonceHeap) Len() int           { return len(h) }
func (h nonceHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h nonceHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
func (h *nonceHeap) Push(x interface{}) {
	*h = append(*h, x.(uint64))
}
func (h *nonceHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}
type txSortedMap struct {
	items map[uint64]*types.Transaction  
	index *nonceHeap                     
	cache types.Transactions             
}
func newTxSortedMap() *txSortedMap {
	return &txSortedMap{
		items: make(map[uint64]*types.Transaction),
		index: new(nonceHeap),
	}
}
func (m *txSortedMap) Get(nonce uint64) *types.Transaction {
	return m.items[nonce]
}
func (m *txSortedMap) Put(tx *types.Transaction) {
	nonce := tx.Nonce()
	if m.items[nonce] == nil {
		heap.Push(m.index, nonce)
	}
	m.items[nonce], m.cache = tx, nil
}
func (m *txSortedMap) Forward(threshold uint64) types.Transactions {
	var removed types.Transactions
	for m.index.Len() > 0 && (*m.index)[0] < threshold {
		nonce := heap.Pop(m.index).(uint64)
		removed = append(removed, m.items[nonce])
		delete(m.items, nonce)
	}
	if m.cache != nil {
		m.cache = m.cache[len(removed):]
	}
	return removed
}