Skip to content

Commit

Permalink
add concurrency unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BeniaminDrasovean committed Nov 29, 2024
1 parent 9bba06e commit f5131bf
Show file tree
Hide file tree
Showing 4 changed files with 396 additions and 1 deletion.
1 change: 1 addition & 0 deletions trie/branchNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ func (bn *branchNode) updateNode(
go func(childPos int) {
updateFunc(data[childPos], childPos, goRoutinesManager, modifiedHashes, hasBeenModified, db)

goRoutinesManager.EndGoRoutineProcessing()
waitGroup.Done()
}(childPos)
}
Expand Down
16 changes: 15 additions & 1 deletion trie/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package trie

import (
"time"


"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/common/statistics"
Expand Down Expand Up @@ -105,3 +106,16 @@ func ExecuteUpdatesFromBatch(tr common.Trie) {
pmt, _ := tr.(*patriciaMerkleTrie)
_ = pmt.updateTrie()
}

func KeyBytesToHex(str []byte) []byte {
return keyBytesToHex(str)
}

func GetBatchManager(tr common.Trie) common.TrieBatchManager {
return tr.(*patriciaMerkleTrie).batchManager
}

func SetGoRoutinesThrottlerToTrie(tr common.Trie, gt core.Throttler) {
pmt, _ := tr.(*patriciaMerkleTrie)
pmt.goroutinesThrottler = gt
}
1 change: 1 addition & 0 deletions trie/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type IdleNodeProvider interface {
IsInterfaceNil() bool
}

// RootManager is used to manage the root node
type RootManager interface {
GetRootNode() node
SetNewRootNode(newRoot node)
Expand Down
Loading

0 comments on commit f5131bf

Please sign in to comment.