diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-03 01:46:55 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-03 01:46:55 +0800 |
commit | 24003c76d12b83602ca93be375a3bc19f4fb3f1b (patch) | |
tree | 90e77c349df52806d78693f93704b92786fcb693 /vm | |
parent | 9c6d9dfc5c9fdd9aeb8f4d9926ed98008b849f2e (diff) | |
parent | 65cad14f9b27db396d036f47814d4843d947ac43 (diff) | |
download | dexon-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.go | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -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 |