From 6672f4b26f9ea3b641b55b730a8b4ffbe119ddf3 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 6 Feb 2020 16:59:20 +0300 Subject: [PATCH] mempool: iterate over slice in GetVerifiedTransactions() It's more efficient and keeps transactions sorted by priority. --- pkg/core/mempool/mem_pool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/core/mempool/mem_pool.go b/pkg/core/mempool/mem_pool.go index 023a7fa68..684464fce 100644 --- a/pkg/core/mempool/mem_pool.go +++ b/pkg/core/mempool/mem_pool.go @@ -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++ }