aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/vm.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-07-01 22:03:02 +0800
committerzelig <viktor.tron@gmail.com>2014-07-01 22:03:02 +0800
commit89630d2826300d119f2cdc9f8af6c94926f478a2 (patch)
treeaa2addd061e2d2a8f3cdc0821260409f31ac3b09 /ethchain/vm.go
parent12972b4b65a303dc3f9e135b0e2d97f8b7a661e2 (diff)
parent550407b0ec78b7026737d1abe28127da8c0c9063 (diff)
downloaddexon-89630d2826300d119f2cdc9f8af6c94926f478a2.tar.gz
dexon-89630d2826300d119f2cdc9f8af6c94926f478a2.tar.zst
dexon-89630d2826300d119f2cdc9f8af6c94926f478a2.zip
merge upstream
Diffstat (limited to 'ethchain/vm.go')
-rw-r--r--ethchain/vm.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go
index 66b5a9182..c5ccb3420 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -347,6 +347,29 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
} else {
stack.Push(ethutil.BigFalse)
}
+
+ case SLT:
+ require(2)
+ x, y := stack.Popn()
+ vm.Printf(" %v < %v", y, x)
+ // x < y
+ if y.Cmp(x) < 0 {
+ stack.Push(ethutil.BigTrue)
+ } else {
+ stack.Push(ethutil.BigFalse)
+ }
+ case SGT:
+ require(2)
+ x, y := stack.Popn()
+ vm.Printf(" %v > %v", y, x)
+
+ // x > y
+ if y.Cmp(x) > 0 {
+ stack.Push(ethutil.BigTrue)
+ } else {
+ stack.Push(ethutil.BigFalse)
+ }
+
case EQ:
require(2)
x, y := stack.Popn()
@@ -661,7 +684,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
// Create a new callable closure
closure := NewClosure(closure, stateObject, stateObject.script, vm.state, gas, closure.Price)
// Executer the closure and get the return value (if any)
- ret, _, err := closure.Call(vm, args, hook)
+ //ret, _, err := closure.Call(vm, args, hook)
+ ret, err, _ := Call(vm, closure, args)
if err != nil {
stack.Push(ethutil.BigFalse)
@@ -700,7 +724,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
return closure.Return(nil), nil
default:
- vmlogger.Debugf("Invalid opcode %x\n", op)
+ vmlogger.Debugf("(pc) %-3v Invalid opcode %x\n", pc, op)
+ fmt.Println(Code(closure.Script))
return closure.Return(nil), fmt.Errorf("Invalid opcode %x", op)
}