Skip to content

Commit ebf6d61

Browse files
committed
fix commit done
1 parent 948d2a6 commit ebf6d61

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

triedb/pathdb/database.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ func (db *Database) CommitState(root common.Hash, parentRoot common.Hash, blockN
218218
db.lock.Lock()
219219
defer db.lock.Unlock()
220220

221+
defer func() {
222+
if callback != nil {
223+
callback()
224+
}
225+
}()
226+
221227
// Short circuit if the mutation is not allowed.
222228
if err := db.modifyAllowed(); err != nil {
223229
return err
@@ -229,9 +235,6 @@ func (db *Database) CommitState(root common.Hash, parentRoot common.Hash, blockN
229235
if flush {
230236
db.timeFlush.Store(flush)
231237
}
232-
if callback != nil {
233-
callback()
234-
}
235238
return nil
236239
}
237240

@@ -252,11 +255,7 @@ func (db *Database) CommitState(root common.Hash, parentRoot common.Hash, blockN
252255
// - head-1 layer is paired with HEAD-1 state
253256
// - head-127 layer(bottom-most diff layer) is paired with HEAD-127 state
254257
// - head-128 layer(disk layer) is paired with HEAD-128 state
255-
err := db.tree.cap(root, maxDiffLayers, flush)
256-
if callback != nil {
257-
callback()
258-
}
259-
return err
258+
return db.tree.cap(root, maxDiffLayers, flush)
260259
}
261260

262261
// Close closes the trie database and the held freezer.

0 commit comments

Comments
 (0)