Skip to content

Commit

Permalink
fix(trie): remove locking on updating preimage of zk trie
Browse files Browse the repository at this point in the history
  • Loading branch information
chokobole committed Mar 19, 2023
1 parent 63ec97f commit c0c31ce
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions trie/zk_trie_database.go
Expand Up @@ -69,12 +69,10 @@ func (l *ZktrieDatabase) Get(key []byte) ([]byte, error) {
func (l *ZktrieDatabase) UpdatePreimage(preimage []byte, hashField *big.Int) {
db := l.db
if db.preimages != nil { // Ugly direct check but avoids the below write lock
db.lock.Lock()
// we must copy the input key
preimages := make(map[common.Hash][]byte)
preimages[common.BytesToHash(hashField.Bytes())] = common.CopyBytes(preimage)
db.preimages.insertPreimage(preimages)
db.lock.Unlock()
}
}

Expand Down

0 comments on commit c0c31ce

Please sign in to comment.