aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_transition.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-07 19:59:09 +0800
committerobscuren <geffobscura@gmail.com>2014-07-07 19:59:09 +0800
commitb01cb2406f94745277fe05dfa74c6e5d42af1c6a (patch)
treee2c2ef277dfe92dc7710501234c6dec807ea6842 /ethchain/state_transition.go
parent42bb3d8aaeb4753ac491c31c746b065dbcbb3781 (diff)
downloadgo-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar.gz
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar.bz2
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar.lz
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar.xz
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.tar.zst
go-tangerine-b01cb2406f94745277fe05dfa74c6e5d42af1c6a.zip
Fixed state reset case
Diffstat (limited to 'ethchain/state_transition.go')
-rw-r--r--ethchain/state_transition.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index 10a795cb8..314d858f2 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -176,15 +176,23 @@ func (self *StateTransition) TransitionState() (err error) {
return
}
- receiver = self.Receiver()
+ /* FIXME
+ * If tx goes TO "0", goes OOG during init, reverse changes, but initial endowment should happen. The ether is lost forever
+ */
+ var snapshot *State
// If the receiver is nil it's a contract (\0*32).
- if receiver == nil {
+ if tx.CreatesContract() {
+ snapshot = self.state.Copy()
+
// Create a new state object for the contract
receiver = self.MakeStateObject(self.state, tx)
+ self.rec = receiver
if receiver == nil {
return fmt.Errorf("Unable to create contract")
}
+ } else {
+ receiver = self.Receiver()
}
// Transfer value from sender to receiver
@@ -192,7 +200,9 @@ func (self *StateTransition) TransitionState() (err error) {
return
}
- snapshot := self.state.Copy()
+ if snapshot == nil {
+ snapshot = self.state.Copy()
+ }
// Process the init code and create 'valid' contract
if IsContractAddr(self.receiver) {