Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions trie/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,15 @@ func (db *Database) Commit(node common.Hash, report bool, callback func(common.H
// commit is the private locked version of Commit.
func (db *Database) commit(hash common.Hash, batch ethdb.Batch, uncacher *cleaner, callback func(common.Hash)) error {
// If the node does not exist, it's a previously committed node

db.lock.RLock()
node, ok := db.dirties[hash]
if !ok {
db.lock.RUnlock()
return nil
}
db.lock.RUnlock()
Comment on lines +759 to +765
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
db.lock.RLock()
node, ok := db.dirties[hash]
if !ok {
db.lock.RUnlock()
return nil
}
db.lock.RUnlock()
db.lock.RLock()
node, ok := db.dirties[hash]
db.lock.RUnlock()
if !ok {
return nil
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this @gballet 👍


var err error
node.forChilds(func(child common.Hash) {
if err == nil {
Expand Down