Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Fixed Race Condition #453 #30

Closed
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
7 changes: 4 additions & 3 deletions checkpoint-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ function _enterCpMode () {
this._scratch = levelup('', {
db: memdown
})
this._getDBs.unshift(this._scratch)

this._getDBs = [this._scratch].concat(this._getDBs)
this.__putDBs = this._putDBs
this._putDBs = [this._scratch]
this._putDBs = [this._scratch].concat(this._getDBs)
Copy link

Choose a reason for hiding this comment

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

don't know much about the code around this, but 've been reading the the related issues that led to this PR ( originally reading from the race conditions issue opened in ganache-cli repo ).

as _putDBs and _getDBs seems to be different objects, is op ( @kammerdiener ) sure that this is not a typo ?

Was this._putDBs = [this._scratch].concat(this._putDBs); intended instead ?

( sorry if it is not, just trying to educate myself ^^" )

this._putRaw = this.putRaw
this.putRaw = putRaw
}
Expand All @@ -105,7 +106,7 @@ function _exitCpMode (commitState, cb) {
var self = this
var scratch = this._scratch
this._scratch = null
this._getDBs.shift()
this._getDBs = this._getDBs.slice(1)
this._putDBs = this.__putDBs
this.putRaw = this._putRaw

Expand Down