소스 검색

core: added accessor for queued transactions

obscuren 10 년 전
부모
커밋
fba40e18d9
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      core/transaction_pool.go

+ 12 - 0
core/transaction_pool.go

@@ -201,6 +201,18 @@ func (self *TxPool) GetTransactions() (txs types.Transactions) {
 	return
 }
 
+func (self *TxPool) GetQueuedTransactions() types.Transactions {
+	self.mu.RLock()
+	defer self.mu.RUnlock()
+
+	var txs types.Transactions
+	for _, ts := range self.queue {
+		txs = append(txs, ts...)
+	}
+
+	return txs
+}
+
 func (self *TxPool) RemoveTransactions(txs types.Transactions) {
 	self.mu.Lock()
 	defer self.mu.Unlock()