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

Method setPendingTx

txnpool/proc/txnpool_server.go:302–321  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

300// setPendingTx adds a transaction to the pending list, if the
301// transaction is already in the pending list, just return false.
302func (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
324func (s *TXPoolServer) assignTxToWorker(tx *tx.Transaction,

Callers 2

assignTxToWorkerMethod · 0.95
reVerifyStatefulMethod · 0.95

Calls 2

DebugfFunction · 0.92
HashMethod · 0.65

Tested by

no test coverage detected