diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-13 07:25:45 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-13 07:25:45 +0800 |
commit | 750d70c2024784227c8ac920d651c337c2de207e (patch) | |
tree | ec792564d4fae7a1d8d84ef1019027a9e6791476 /vm | |
parent | 34689cb3f369ad71164b81d0c05238d78cb67945 (diff) | |
download | dexon-750d70c2024784227c8ac920d651c337c2de207e.tar.gz dexon-750d70c2024784227c8ac920d651c337c2de207e.tar.zst dexon-750d70c2024784227c8ac920d651c337c2de207e.zip |
updated tests
Diffstat (limited to 'vm')
-rw-r--r-- | vm/vm_debug.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 81db45f19..255faefb0 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -50,10 +50,6 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * vmlogger.Debugf("(%d) (%x) %x (code=%d) gas: %v (d) %x\n", self.env.Depth(), caller.Address()[:4], context.Address(), len(code), context.Gas, callData) - if p := Precompiled[string(me.Address())]; p != nil { - return self.RunPrecompiled(p, callData, context) - } - if self.Recoverable { // Recover from any require exception defer func() { @@ -70,6 +66,10 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * }() } + if p := Precompiled[string(me.Address())]; p != nil { + return self.RunPrecompiled(p, callData, context) + } + var ( op OpCode @@ -513,10 +513,12 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * // 0x40 range case BLOCKHASH: num := stack.Pop() - if num.Cmp(new(big.Int).Sub(self.env.BlockNumber(), ethutil.Big256)) < 0 { - stack.Push(ethutil.Big0) - } else { + + n := U256(new(big.Int).Sub(self.env.BlockNumber(), ethutil.Big257)) + if num.Cmp(n) > 0 && num.Cmp(self.env.BlockNumber()) < 0 { stack.Push(ethutil.BigD(self.env.GetHash(num.Uint64()))) + } else { + stack.Push(ethutil.Big0) } self.Printf(" => 0x%x", stack.Peek().Bytes()) |