aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/vm.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/vm/vm.go b/vm/vm.go
index ed3379a44..b9282435e 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -16,6 +16,8 @@ type Vm struct {
logStr string
err error
+ // For logging
+ debug bool
Dbg Debugger
@@ -32,7 +34,7 @@ func New(env Environment) *Vm {
lt = LogTyDiff
}
- return &Vm{env: env, logTy: lt, Recoverable: true}
+ return &Vm{debug: false, env: env, logTy: lt, Recoverable: true}
}
func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.Int, callData []byte) (ret []byte, err error) {
@@ -666,6 +668,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
}
addr = ref.Address()
+ fmt.Printf("CREATE %X\n", addr)
stack.Push(ethutil.BigD(addr))
}
@@ -830,7 +833,7 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// 0 => non 0
mult = ethutil.Big3
} else if len(val) > 0 && len(y.Bytes()) == 0 {
- statedb.Refund(caller.Address(), GasSStoreRefund)
+ statedb.Refund(self.env.Origin(), GasSStoreRefund)
mult = ethutil.Big0
} else {
@@ -939,17 +942,21 @@ func (self *Vm) RunPrecompiled(p *PrecompiledAccount, callData []byte, context *
}
func (self *Vm) Printf(format string, v ...interface{}) VirtualMachine {
- if self.logTy == LogTyPretty {
- self.logStr += fmt.Sprintf(format, v...)
+ if self.debug {
+ if self.logTy == LogTyPretty {
+ self.logStr += fmt.Sprintf(format, v...)
+ }
}
return self
}
func (self *Vm) Endl() VirtualMachine {
- if self.logTy == LogTyPretty {
- vmlogger.Debugln(self.logStr)
- self.logStr = ""
+ if self.debug {
+ if self.logTy == LogTyPretty {
+ vmlogger.Debugln(self.logStr)
+ self.logStr = ""
+ }
}
return self