Skip to content

Commit

Permalink
Merge pull request #562 from ethereumjs/fix/cache-err-cb
Browse files Browse the repository at this point in the history
fix: propagate errors occuring in cache._flush
  • Loading branch information
holgerd77 authored Jul 26, 2019
2 parents 0ccb64f + 616b907 commit e26585f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/state/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export default class Cache {
if (it.value && it.value.modified) {
it.value.modified = false
it.value.val = it.value.val.serialize()
this._trie.put(Buffer.from(it.key, 'hex'), it.value.val, () => {
this._trie.put(Buffer.from(it.key, 'hex'), it.value.val, (err: Error) => {
if (err) return done(err)
next = it.hasNext
it.next()
done()
Expand All @@ -134,7 +135,8 @@ export default class Cache {
it.value.modified = false
it.value.deleted = false
it.value.val = new Account().serialize()
this._trie.del(Buffer.from(it.key, 'hex'), () => {
this._trie.del(Buffer.from(it.key, 'hex'), (err: Error) => {
if (err) return done(err)
next = it.hasNext
it.next()
done()
Expand Down

0 comments on commit e26585f

Please sign in to comment.