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

Method cleanTransactionList

txnpool/proc/txnpool_server.go:531–562  ·  view source on GitHub ↗

cleanTransactionList cleans the txs in the block from the ledger

(txs []*tx.Transaction, height uint32)

Source from the content-addressed store, hash-verified

529
530// cleanTransactionList cleans the txs in the block from the ledger
531func (s *TXPoolServer) cleanTransactionList(txs []*tx.Transaction, height uint32) {
532 s.txPool.CleanTransactionList(txs)
533
534 // Check whether to update the gas price and remove txs below the
535 // threshold
536 if height%tc.UPDATE_FREQUENCY == 0 {
537 gasPrice := getGasPriceConfig()
538 s.mu.Lock()
539 oldGasPrice := s.gasPrice
540 s.gasPrice = gasPrice
541 s.mu.Unlock()
542 if oldGasPrice != gasPrice {
543 log.Infof("Transaction pool price threshold updated from %d to %d",
544 oldGasPrice, gasPrice)
545 }
546
547 if oldGasPrice < gasPrice {
548 s.txPool.RemoveTxsBelowGasPrice(gasPrice)
549 }
550 }
551 // Cleanup tx pool
552 if !s.disablePreExec {
553 remain := s.txPool.Remain()
554 for _, t := range remain {
555 if ok, _ := preExecCheck(t); !ok {
556 log.Debugf("cleanTransactionList: preExecCheck tx %x failed", t.Hash())
557 continue
558 }
559 s.reVerifyStateful(t, tc.NilSender)
560 }
561 }
562}
563
564// delTransaction deletes a transaction in the tx pool.
565func (s *TXPoolServer) delTransaction(t *tx.Transaction) {

Callers 2

TestWorkerFunction · 0.80
ReceiveMethod · 0.80

Calls 9

reVerifyStatefulMethod · 0.95
InfofFunction · 0.92
DebugfFunction · 0.92
getGasPriceConfigFunction · 0.85
preExecCheckFunction · 0.85
CleanTransactionListMethod · 0.80
RemainMethod · 0.80
HashMethod · 0.65

Tested by 1

TestWorkerFunction · 0.64