diff options
author | Felix Lange <fjl@twurst.com> | 2016-10-04 18:36:02 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-10-06 21:32:16 +0800 |
commit | 1f1ea18b5414bea22332bb4fce53cc95b5c6a07d (patch) | |
tree | d1aa3051f9c4d9f33a24519c18b70f0dd2f00644 /eth/api_backend.go | |
parent | ab7adb0027dbcf09cf75a533be356c1e24c46c90 (diff) | |
download | dexon-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.gz dexon-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.zst dexon-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.zip |
core/state: implement reverts by journaling all changes
This commit replaces the deep-copy based state revert mechanism with a
linear complexity journal. This commit also hides several internal
StateDB methods to limit the number of ways in which calling code can
use the journal incorrectly.
As usual consultation and bug fixes to the initial implementation were
provided by @karalabe, @obscuren and @Arachnid. Thank you!
Diffstat (limited to 'eth/api_backend.go')
-rw-r--r-- | eth/api_backend.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go index 4adeb0aa0..42b84bf9b 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -98,12 +98,12 @@ func (b *EthApiBackend) GetTd(blockHash common.Hash) *big.Int { } func (b *EthApiBackend) GetVMEnv(ctx context.Context, msg core.Message, state ethapi.State, header *types.Header) (vm.Environment, func() error, error) { - stateDb := state.(EthApiState).state.Copy() + statedb := state.(EthApiState).state addr, _ := msg.From() - from := stateDb.GetOrNewStateObject(addr) + from := statedb.GetOrNewStateObject(addr) from.SetBalance(common.MaxBig) vmError := func() error { return nil } - return core.NewEnv(stateDb, b.eth.chainConfig, b.eth.blockchain, msg, header, b.eth.chainConfig.VmConfig), vmError, nil + return core.NewEnv(statedb, b.eth.chainConfig, b.eth.blockchain, msg, header, b.eth.chainConfig.VmConfig), vmError, nil } func (b *EthApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { |