MCPcopy Create free account
hub / github.com/DNAProject/DNA / AddTxList

Method AddTxList

txnpool/common/transaction_pool.go:68–80  ·  view source on GitHub ↗

AddTxList adds a valid transaction to the transaction pool. If the transaction is already in the pool, just return false. Parameter txEntry includes transaction, fee, and verified information(height, validator, error code).

(txEntry *TXEntry)

Source from the content-addressed store, hash-verified

66// txEntry includes transaction, fee, and verified information(height,
67// validator, error code).
68func (tp *TXPool) AddTxList(txEntry *TXEntry) bool {
69 tp.Lock()
70 defer tp.Unlock()
71 txHash := txEntry.Tx.Hash()
72 if _, ok := tp.txList[txHash]; ok {
73 log.Infof("AddTxList: transaction %x is already in the pool",
74 txHash)
75 return false
76 }
77
78 tp.txList[txHash] = txEntry
79 return true
80}
81
82// CleanTransactionList cleans the transaction list included in the ledger.
83func (tp *TXPool) CleanTransactionList(txs []*types.Transaction) error {

Callers 2

TestTxPoolFunction · 0.95
addTxListMethod · 0.80

Calls 2

InfofFunction · 0.92
HashMethod · 0.65

Tested by 1

TestTxPoolFunction · 0.76