diff --git a/pkg/core/mem_pool.go b/pkg/core/mem_pool.go index 8af3bdc35..52611dc74 100644 --- a/pkg/core/mem_pool.go +++ b/pkg/core/mem_pool.go @@ -226,8 +226,8 @@ func NewMemPool(capacity int) MemPool { // TryGetValue returns a transaction if it exists in the memory pool. func (mp MemPool) TryGetValue(hash util.Uint256) (*transaction.Transaction, bool) { - mp.lock.Lock() - defer mp.lock.Unlock() + mp.lock.RLock() + defer mp.lock.RUnlock() if pItem, ok := mp.unsortedTxn[hash]; ok { return pItem.txn, ok } @@ -271,8 +271,8 @@ func min(sortedPool PoolItems) *PoolItem { func (mp *MemPool) GetVerifiedTransactions() []*transaction.Transaction { var t []*transaction.Transaction - mp.lock.Lock() - defer mp.lock.Unlock() + mp.lock.RLock() + defer mp.lock.RUnlock() for _, p := range mp.unsortedTxn { t = append(t, p.txn) }