func (p *TxPool) GetTransaction(hash common.Uint256) *types.Transaction {
	p.RLock()
	defer p.RUnlock()
	return p.getTransaction(hash)
}
get the transaction by hash
package mempool
import (
	"bytes"
	"fmt"
	"sync"
	"github.com/elastos/Elastos.ELA.SideChain/blockchain"
	"github.com/elastos/Elastos.ELA.SideChain/config"
	"github.com/elastos/Elastos.ELA.SideChain/events"
	"github.com/elastos/Elastos.ELA.SideChain/spv"
	"github.com/elastos/Elastos.ELA.SideChain/types"
	"github.com/elastos/Elastos.ELA/common"
)
type Config struct {
	ChainParams *config.Params
	Chain       *blockchain.BlockChain
	ChainStore  *blockchain.ChainStore
	SpvService  *spv.Service
	Validator   *Validator
	FeeHelper   *FeeHelper
}
type TxPool struct {
	conflictManager
	chainParams *config.Params
	validator   *Validator
	feeHelper   *FeeHelper
	sync.RWMutex
	txCount uint64                                 
	txnList map[common.Uint256]*types.Transaction  
}
func New(cfg *Config) *TxPool {
	p := TxPool{
		chainParams:     cfg.ChainParams,
		validator:       cfg.Validator,
		feeHelper:       cfg.FeeHelper,
		conflictManager: newConflictManager(cfg.Chain),
		txCount:         0,
		txnList:         make(map[common.Uint256]*types.Transaction),
	}
	return &p
}
func (p *TxPool) AppendToTxPool(tx *types.Transaction) error {
	p.Lock()
	defer p.Unlock()
	if err := p.appendToTxPool(tx); err != nil {
		return err
	}
	go events.Notify(events.ETTransactionAccepted, tx)
	return nil
}
func (p *TxPool) appendToTxPool(tx *types.Transaction) error {
	if err := p.validator.CheckTransactionSanity(tx); err != nil {
		return err
	}
	if err := p.validator.CheckTransactionContext(tx); err != nil {
		return err
	}
	if err := p.verifyTransactionWithTxnPool(tx); err != nil {
		return err
	}
	fee, err := p.feeHelper.GetTxFee(tx, p.chainParams.ElaAssetId)
	if err != nil {
		return err
	}
	tx.Fee = fee
	buf := new(bytes.Buffer)
	tx.Serialize(buf)
	tx.FeePerKB = tx.Fee * 1000 / common.Fixed64(len(buf.Bytes()))
	if errCode := p.AppendTx(tx); errCode != nil {
		log.Warn("[TxPool verifyTransactionWithTxnPool] failed", tx.Hash())
		return errCode
	}
	p.txnList[tx.Hash()] = tx
	return nil
}
func (p *TxPool) HaveTransaction(txId common.Uint256) bool {
	p.RLock()
	defer p.RUnlock()
	_, ok := p.txnList[txId]
	return ok
}
func (p *TxPool) GetTxsInPool() map[common.Uint256]*types.Transaction {
	p.RLock()
	defer p.RUnlock()
	copy := make(map[common.Uint256]*types.Transaction)
	for txId, tx := range p.txnList {
		copy[txId] = tx
	}
	return copy
}
func (p *TxPool) CleanSubmittedTransactions(block *types.Block) error {
	p.Lock()
	defer p.Unlock()
	p.cleanMainChainTx(block.Transactions)
	return p.cleanTransactionList(block.Transactions)
}