diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-10-06 22:14:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-06 22:14:22 +0800 |
commit | 7335a70a020517cc9cebe7ae82c0e49ba133abf1 (patch) | |
tree | cc63625fa07bf3fb28326a01d5c8255a83a83bd1 /miner | |
parent | 07caa3fccdfe11bbee084c043ac11e7cfae9a6b7 (diff) | |
parent | 3c836dd71b192de24774b1848173a4eb0ca9a63b (diff) | |
download | dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.gz dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.bz2 dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.lz dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.xz dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.zst dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.zip |
Merge pull request #3092 from fjl/state-journal
core/state: implement reverts by journaling all changes
Diffstat (limited to 'miner')
-rw-r--r-- | miner/worker.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/miner/worker.go b/miner/worker.go index ac1ef5ba3..e5348cef4 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -171,7 +171,7 @@ func (self *worker) pending() (*types.Block, *state.StateDB) { self.current.receipts, ), self.current.state } - return self.current.Block, self.current.state + return self.current.Block, self.current.state.Copy() } func (self *worker) start() { @@ -618,7 +618,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB } func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, gp *core.GasPool) (error, vm.Logs) { - snap := env.state.Copy() + snap := env.state.Snapshot() // this is a bit of a hack to force jit for the miners config := env.config.VmConfig @@ -629,7 +629,7 @@ func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, g receipt, logs, _, err := core.ApplyTransaction(env.config, bc, gp, env.state, env.header, tx, env.header.GasUsed, config) if err != nil { - env.state.Set(snap) + env.state.RevertToSnapshot(snap) return err, nil } env.txs = append(env.txs, tx) |