func (mem *Mempool) Unlock() {
	mem.proxyMtx.Unlock()
}
Unlock unlocks the mempool.
package mempool
import (
	"bytes"
	"container/list"
	"fmt"
	"sync"
	"sync/atomic"
	"time"
	"github.com/pkg/errors"
	abci "github.com/tendermint/tendermint/abci/types"
	auto "github.com/tendermint/tendermint/libs/autofile"
	"github.com/tendermint/tendermint/libs/clist"
	cmn "github.com/tendermint/tendermint/libs/common"
	"github.com/tendermint/tendermint/libs/log"
	cfg "github.com/tendermint/tendermint/config"
	"github.com/tendermint/tendermint/proxy"
	"github.com/tendermint/tendermint/types"
)
var (
	ErrTxInCache = errors.New("Tx already exists in cache")
	ErrMempoolIsFull = errors.New("Mempool is full")
)
func TxID(tx []byte) string {
	return fmt.Sprintf("%X", types.Tx(tx).Hash())
}
type Mempool struct {
	config *cfg.MempoolConfig
	proxyMtx             sync.Mutex
	proxyAppConn         proxy.AppConnMempool
	txs                  *clist.CList     
	counter              int64            
	height               int64            
	rechecking           int32            
	recheckCursor        *clist.CElement  
	recheckEnd           *clist.CElement  
	notifiedTxsAvailable bool
	txsAvailable         chan struct{}  
	cache txCache
	wal *auto.AutoFile
	logger log.Logger
	metrics *Metrics
}
type MempoolOption func(*Mempool)
func NewMempool(
	config *cfg.MempoolConfig,
	proxyAppConn proxy.AppConnMempool,
	height int64,
	options ...MempoolOption,
) *Mempool {
	mempool := &Mempool{
		config:        config,
		proxyAppConn:  proxyAppConn,
		txs:           clist.New(),
		counter:       0,
		height:        height,
		rechecking:    0,
		recheckCursor: nil,
		recheckEnd:    nil,
		logger:        log.NewNopLogger(),
		metrics:       NopMetrics(),
	}
	if config.CacheSize > 0 {
		mempool.cache = newMapTxCache(config.CacheSize)
	} else {
		mempool.cache = nopTxCache{}
	}
	proxyAppConn.SetResponseCallback(mempool.resCb)
	for _, option := range options {
		option(mempool)
	}
	return mempool
}
func (mem *Mempool) EnableTxsAvailable() {
	mem.txsAvailable = make(chan struct{}, 1)
}
func (mem *Mempool) SetLogger(l log.Logger) {
	mem.logger = l
}
func WithMetrics(metrics *Metrics) MempoolOption {
	return func(mem *Mempool) { mem.metrics = metrics }
}
func (mem *Mempool) CloseWAL() bool {
	if mem == nil {
		return false
	}
	mem.proxyMtx.Lock()
	defer mem.proxyMtx.Unlock()
	if mem.wal == nil {
		return false
	}
	if err := mem.wal.Close(); err != nil && mem.logger != nil {
		mem.logger.Error("Mempool.CloseWAL", "err", err)
	}
	mem.wal = nil
	return true
}
func (mem *Mempool) InitWAL() {
	walDir := mem.config.WalDir()
	if walDir != "" {
		err := cmn.EnsureDir(walDir, 0700)
		if err != nil {
			cmn.PanicSanity(errors.Wrap(err, "Error ensuring Mempool wal dir"))
		}
		af, err := auto.OpenAutoFile(walDir + "/wal")
		if err != nil {
			cmn.PanicSanity(errors.Wrap(err, "Error opening Mempool wal file"))
		}
		mem.wal = af
	}
}
func (mem *Mempool) Lock() {
	mem.proxyMtx.Lock()
}