From fba40e18d9c231b3ab7ee7f6eba36ac859dffbb2 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 23 Apr 2015 10:51:13 +0200 Subject: [PATCH] core: added accessor for queued transactions --- core/transaction_pool.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 9c175e568e..7098dba231 100644 --- a/core/transaction_pool.go +++ b/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()