Removed some logging

This commit is contained in:
obscuren 2014-06-20 00:42:26 +02:00
parent 6fcc6a2f7c
commit 8f29f6a4d4
2 changed files with 10 additions and 9 deletions

@ -281,10 +281,12 @@ func (sm *StateManager) ValidateBlock(block *Block) error {
return ValidationError("Block timestamp less then prev block %v", diff) return ValidationError("Block timestamp less then prev block %v", diff)
} }
/* XXX
// New blocks must be within the 15 minute range of the last block. // New blocks must be within the 15 minute range of the last block.
if diff > int64(15*time.Minute) { if diff > int64(15*time.Minute) {
return ValidationError("Block is too far in the future of last block (> 15 minutes)") return ValidationError("Block is too far in the future of last block (> 15 minutes)")
} }
*/
// Verify the nonce of the block. Return an error if it's not valid // Verify the nonce of the block. Return an error if it's not valid
if !sm.Pow.Verify(block.HashNoNonce(), block.Difficulty, block.Nonce) { if !sm.Pow.Verify(block.HashNoNonce(), block.Difficulty, block.Nonce) {

@ -219,25 +219,23 @@ func (self *StateTransition) Transition() (ret []byte, err error) {
// and use the return value as the // and use the return value as the
// script section for the state object. // script section for the state object.
self.data = nil self.data = nil
ethutil.Config.Log.Println(ethutil.LogLevelSystem, receiver.Init())
code, err := self.Eval(receiver.Init(), receiver) code, err, deepErr := self.Eval(receiver.Init(), receiver)
if err != nil { if err != nil || deepErr {
self.state.ResetStateObject(receiver) self.state.ResetStateObject(receiver)
return nil, fmt.Errorf("Error during init script run %v", err) return nil, fmt.Errorf("Error during init script run %v (deepErr = %v)", err, deepErr)
} }
receiver.script = code receiver.script = code
} else { } else {
if len(receiver.Script()) > 0 { if len(receiver.Script()) > 0 {
ethutil.Config.Log.Println(ethutil.LogLevelSystem, receiver.Script()) var deepErr bool
ret, err, deepErr = self.Eval(receiver.Script(), receiver)
ret, err = self.Eval(receiver.Script(), receiver)
if err != nil { if err != nil {
self.state.ResetStateObject(receiver) self.state.ResetStateObject(receiver)
return nil, fmt.Errorf("Error during code execution %v", err) return nil, fmt.Errorf("Error during code execution %v (deepErr = %v)", err, deepErr)
} }
} }
} }
@ -262,7 +260,7 @@ func (self *StateTransition) transferValue(sender, receiver *StateObject) error
return nil return nil
} }
func (self *StateTransition) Eval(script []byte, context *StateObject) (ret []byte, err error) { func (self *StateTransition) Eval(script []byte, context *StateObject) (ret []byte, err error, deepErr bool) {
var ( var (
block = self.block block = self.block
initiator = self.Sender() initiator = self.Sender()
@ -282,6 +280,7 @@ func (self *StateTransition) Eval(script []byte, context *StateObject) (ret []by
}) })
vm.Verbose = true vm.Verbose = true
ret, _, err = closure.Call(vm, self.data, nil) ret, _, err = closure.Call(vm, self.data, nil)
deepErr = vm.err != nil
return return
} }