aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2015-03-03 01:46:55 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2015-03-03 01:46:55 +0800
commit24003c76d12b83602ca93be375a3bc19f4fb3f1b (patch)
tree90e77c349df52806d78693f93704b92786fcb693 /vm
parent9c6d9dfc5c9fdd9aeb8f4d9926ed98008b849f2e (diff)
parent65cad14f9b27db396d036f47814d4843d947ac43 (diff)
downloaddexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.gz
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.zst
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.zip
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'vm')
-rw-r--r--vm/vm.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/vm/vm.go b/vm/vm.go
index f9efeed96..1f386d47c 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) {
@@ -664,6 +666,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))
}
@@ -727,7 +730,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
self.Printf(" => (%x) %v", receiver.Address()[:4], balance)
- receiver.AddAmount(balance)
+ receiver.AddBalance(balance)
statedb.Delete(context.Address())
fallthrough
@@ -828,7 +831,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 {
@@ -937,17 +940,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