aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-07 16:53:20 +0800
committerobscuren <geffobscura@gmail.com>2014-07-07 16:53:20 +0800
commitd40cba3042564f3471aa20a5cf477cafcacc2189 (patch)
treeb8b1218e456d3daaad4a36e6ba022323c3762038 /ethchain
parent1199941475452e8d62fb2d5b634672e3f7c48bfd (diff)
downloadgo-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar.gz
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar.bz2
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar.lz
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar.xz
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.tar.zst
go-tangerine-d40cba3042564f3471aa20a5cf477cafcacc2189.zip
changed state reset
Diffstat (limited to 'ethchain')
-rw-r--r--ethchain/state.go4
-rw-r--r--ethchain/state_transition.go14
2 files changed, 9 insertions, 9 deletions
diff --git a/ethchain/state.go b/ethchain/state.go
index 20af94fe8..5d023df7b 100644
--- a/ethchain/state.go
+++ b/ethchain/state.go
@@ -161,7 +161,9 @@ func (self *State) Set(state *State) {
panic("Tried setting 'state' to nil through 'Set'")
}
- *self = *state
+ self.trie = state.trie
+ self.stateObjects = state.stateObjects
+ //*self = *state
}
func (s *State) Put(key, object []byte) {
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index 6ea9a837d..a92aa4a33 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -164,8 +164,6 @@ func (self *StateTransition) TransitionState() (err error) {
// Increment the nonce for the next transaction
sender.Nonce += 1
- receiver = self.Receiver()
-
// Transaction gas
if err = self.UseGas(GasTx); err != nil {
return
@@ -178,6 +176,10 @@ func (self *StateTransition) TransitionState() (err error) {
return
}
+ snapshot := self.state.Copy()
+
+ receiver = self.Receiver()
+
// If the receiver is nil it's a contract (\0*32).
if receiver == nil {
// Create a new state object for the contract
@@ -192,8 +194,6 @@ func (self *StateTransition) TransitionState() (err error) {
return
}
- //snapshot := self.state.Copy()
-
// Process the init code and create 'valid' contract
if IsContractAddr(self.receiver) {
// Evaluate the initialization script
@@ -203,8 +203,7 @@ func (self *StateTransition) TransitionState() (err error) {
code, err := self.Eval(receiver.Init(), receiver, "init")
if err != nil {
- //self.state.Set(snapshot)
- self.state.ResetStateObject(receiver)
+ self.state.Set(snapshot)
return fmt.Errorf("Error during init execution %v", err)
}
@@ -214,8 +213,7 @@ func (self *StateTransition) TransitionState() (err error) {
if len(receiver.Script()) > 0 {
_, err = self.Eval(receiver.Script(), receiver, "code")
if err != nil {
- //self.state.Set(snapshot)
- self.state.ResetStateObject(receiver)
+ self.state.Set(snapshot)
return fmt.Errorf("Error during code execution %v", err)
}