Skip to content

Commit

Permalink
Introduce stateManager.copy() and use that in VM.copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
axic authored and holgerd77 committed Mar 6, 2018
1 parent 9bc99c3 commit 8fe46e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ VM.prototype.runCall = require('./runCall.js')
VM.prototype.runBlockchain = require('./runBlockchain.js')

VM.prototype.copy = function () {
return new VM({
state: this.trie.copy(),
blockchain: this.blockchain
})
return new VM({ stateManager: this.stateManager.copy() })
}

/**
Expand Down
4 changes: 4 additions & 0 deletions lib/stateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function StateManager (opts) {

var proto = StateManager.prototype

proto.copy = function () {
return new StateManager({ trie: this.trie.copy(), blockchain: this.blockchain })
}

// gets the account from the cache, or triggers a lookup and stores
// the result in the cache
proto.getAccount = function (address, cb) {
Expand Down

0 comments on commit 8fe46e5

Please sign in to comment.