diff options
-rw-r--r-- | ethchain/state.go | 4 | ||||
-rw-r--r-- | ethchain/state_transition.go | 14 | ||||
-rw-r--r-- | ethereum.go | 2 | ||||
-rw-r--r-- | peer.go | 2 |
4 files changed, 12 insertions, 10 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) } diff --git a/ethereum.go b/ethereum.go index de4e915a1..69fcc338e 100644 --- a/ethereum.go +++ b/ethereum.go @@ -432,6 +432,8 @@ func (s *Ethereum) Seed() { s.ConnectToPeer(string(body)) } + + s.ConnectToPeer("54.204.10.41:30303") } func (s *Ethereum) peerHandler(listener net.Listener) { @@ -21,7 +21,7 @@ const ( // The size of the output buffer for writing messages outputBufferSize = 50 // Current protocol version - ProtocolVersion = 21 + ProtocolVersion = 22 // Interval for ping/pong message pingPongTimer = 2 * time.Second ) |