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)
| 66 | // txEntry includes transaction, fee, and verified information(height, |
| 67 | // validator, error code). |
| 68 | func (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. |
| 83 | func (tp *TXPool) CleanTransactionList(txs []*types.Transaction) error { |