changed state reset
This commit is contained in:
parent
1199941475
commit
d40cba3042
@ -161,7 +161,9 @@ func (self *State) Set(state *State) {
|
|||||||
panic("Tried setting 'state' to nil through 'Set'")
|
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) {
|
func (s *State) Put(key, object []byte) {
|
||||||
|
@ -164,8 +164,6 @@ func (self *StateTransition) TransitionState() (err error) {
|
|||||||
// Increment the nonce for the next transaction
|
// Increment the nonce for the next transaction
|
||||||
sender.Nonce += 1
|
sender.Nonce += 1
|
||||||
|
|
||||||
receiver = self.Receiver()
|
|
||||||
|
|
||||||
// Transaction gas
|
// Transaction gas
|
||||||
if err = self.UseGas(GasTx); err != nil {
|
if err = self.UseGas(GasTx); err != nil {
|
||||||
return
|
return
|
||||||
@ -178,6 +176,10 @@ func (self *StateTransition) TransitionState() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot := self.state.Copy()
|
||||||
|
|
||||||
|
receiver = self.Receiver()
|
||||||
|
|
||||||
// If the receiver is nil it's a contract (\0*32).
|
// If the receiver is nil it's a contract (\0*32).
|
||||||
if receiver == nil {
|
if receiver == nil {
|
||||||
// Create a new state object for the contract
|
// Create a new state object for the contract
|
||||||
@ -192,8 +194,6 @@ func (self *StateTransition) TransitionState() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//snapshot := self.state.Copy()
|
|
||||||
|
|
||||||
// Process the init code and create 'valid' contract
|
// Process the init code and create 'valid' contract
|
||||||
if IsContractAddr(self.receiver) {
|
if IsContractAddr(self.receiver) {
|
||||||
// Evaluate the initialization script
|
// Evaluate the initialization script
|
||||||
@ -203,8 +203,7 @@ func (self *StateTransition) TransitionState() (err error) {
|
|||||||
|
|
||||||
code, err := self.Eval(receiver.Init(), receiver, "init")
|
code, err := self.Eval(receiver.Init(), receiver, "init")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//self.state.Set(snapshot)
|
self.state.Set(snapshot)
|
||||||
self.state.ResetStateObject(receiver)
|
|
||||||
|
|
||||||
return fmt.Errorf("Error during init execution %v", err)
|
return fmt.Errorf("Error during init execution %v", err)
|
||||||
}
|
}
|
||||||
@ -214,8 +213,7 @@ func (self *StateTransition) TransitionState() (err error) {
|
|||||||
if len(receiver.Script()) > 0 {
|
if len(receiver.Script()) > 0 {
|
||||||
_, err = self.Eval(receiver.Script(), receiver, "code")
|
_, err = self.Eval(receiver.Script(), receiver, "code")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//self.state.Set(snapshot)
|
self.state.Set(snapshot)
|
||||||
self.state.ResetStateObject(receiver)
|
|
||||||
|
|
||||||
return fmt.Errorf("Error during code execution %v", err)
|
return fmt.Errorf("Error during code execution %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user