mempool: iterate over slice in GetVerifiedTransactions()

It's more efficient and keeps transactions sorted by priority.
This commit is contained in:
Roman Khimov 2020-02-06 16:59:20 +03:00
parent e97396e56c
commit 6672f4b26f

View file

@ -251,10 +251,10 @@ func (mp *Pool) GetVerifiedTransactions() []*transaction.Transaction {
mp.lock.RLock()
defer mp.lock.RUnlock()
var t = make([]*transaction.Transaction, len(mp.verifiedMap))
var t = make([]*transaction.Transaction, len(mp.verifiedTxes))
var i int
for _, p := range mp.verifiedMap {
for _, p := range mp.verifiedTxes {
t[i] = p.txn
i++
}