setPendingTx adds a transaction to the pending list, if the transaction is already in the pending list, just return false.
(tx *tx.Transaction, sender tc.SenderType, txResultCh chan *tc.TxResult)
| 300 | // setPendingTx adds a transaction to the pending list, if the |
| 301 | // transaction is already in the pending list, just return false. |
| 302 | func (s *TXPoolServer) setPendingTx(tx *tx.Transaction, |
| 303 | sender tc.SenderType, txResultCh chan *tc.TxResult) bool { |
| 304 | |
| 305 | s.mu.Lock() |
| 306 | defer s.mu.Unlock() |
| 307 | if ok := s.allPendingTxs[tx.Hash()]; ok != nil { |
| 308 | log.Debugf("setPendingTx: transaction %x already in the verifying process", |
| 309 | tx.Hash()) |
| 310 | return false |
| 311 | } |
| 312 | |
| 313 | pt := &serverPendingTx{ |
| 314 | tx: tx, |
| 315 | sender: sender, |
| 316 | ch: txResultCh, |
| 317 | } |
| 318 | |
| 319 | s.allPendingTxs[tx.Hash()] = pt |
| 320 | return true |
| 321 | } |
| 322 | |
| 323 | // assignTxToWorker assigns a new transaction to a worker by LB |
| 324 | func (s *TXPoolServer) assignTxToWorker(tx *tx.Transaction, |
no test coverage detected