Skip to content

Commit

Permalink
fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BeniaminDrasovean committed Dec 12, 2024
1 parent 1ae9ffb commit bf0f1b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions trie/baseNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type baseNode struct {
}

func (bn *baseNode) getHash() []byte {
bn.mutex.RLock()
defer bn.mutex.RUnlock()

return bn.hash
}

Expand All @@ -23,6 +26,9 @@ func (bn *baseNode) setGivenHash(hash []byte) {
}

func (bn *baseNode) isDirty() bool {
bn.mutex.RLock()
defer bn.mutex.RUnlock()

return bn.dirty
}

Expand Down
18 changes: 9 additions & 9 deletions trie/patriciaMerkleTrie.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ func (tr *patriciaMerkleTrie) getRootHash() ([]byte, error) {
return hash, nil
}

manager, err := NewGoroutinesManager(tr.goroutinesThrottler, errChan.NewErrChanWrapper(), tr.chanClose)
err := tr.goRoutinesManager.SetNewErrorChannel(errChan.NewErrChanWrapper())
if err != nil {
return nil, err
}

rootNode.setHash(manager)
err = manager.GetError()
rootNode.setHash(tr.goRoutinesManager)
err = tr.goRoutinesManager.GetError()
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -353,13 +353,13 @@ func (tr *patriciaMerkleTrie) Commit() error {
return nil
}

manager, err := NewGoroutinesManager(tr.goroutinesThrottler, errChan.NewErrChanWrapper(), tr.chanClose)
err = tr.goRoutinesManager.SetNewErrorChannel(errChan.NewErrChanWrapper())
if err != nil {
return err
}

rootNode.setHash(manager)
err = manager.GetError()
rootNode.setHash(tr.goRoutinesManager)
err = tr.goRoutinesManager.GetError()
if err != nil {
return err
}
Expand Down Expand Up @@ -482,13 +482,13 @@ func (tr *patriciaMerkleTrie) GetDirtyHashes() (common.ModifiedHashes, error) {
return nil, nil
}

manager, err := NewGoroutinesManager(tr.goroutinesThrottler, errChan.NewErrChanWrapper(), tr.chanClose)
err = tr.goRoutinesManager.SetNewErrorChannel(errChan.NewErrChanWrapper())
if err != nil {
return nil, err
}

rootNode.setHash(manager)
err = manager.GetError()
rootNode.setHash(tr.goRoutinesManager)
err = tr.goRoutinesManager.GetError()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit bf0f1b6

Please sign in to comment.