aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-07 17:05:49 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-07 17:05:49 +0800
commit45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad (patch)
tree7da960d4b9f532107fbcff555a10cd952ef2e3b2
parent050684450befaac8972120688b69825e8f0acbca (diff)
downloaddexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar.gz
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar.bz2
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar.lz
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar.xz
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.tar.zst
dexon-45ce820b111ab2b4e4c7b8d83dd8bebf1bb37bad.zip
Implemented value()
-rw-r--r--ethchain/state_manager.go1
-rw-r--r--ethchain/vm.go6
2 files changed, 5 insertions, 2 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index 501ec102b..e8843a89e 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -331,6 +331,7 @@ func (sm *StateManager) EvalScript(script []byte, object *StateObject, tx *Trans
Coinbase: block.Coinbase,
Time: block.Time,
Diff: block.Difficulty,
+ Value: tx.Value,
//Price: tx.GasPrice,
})
closure.Call(vm, tx.Data, nil)
diff --git a/ethchain/vm.go b/ethchain/vm.go
index 3a3b3447a..234f7f72a 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethutil"
_ "github.com/obscuren/secp256k1-go"
+ "log"
_ "math"
"math/big"
)
@@ -53,6 +54,7 @@ type RuntimeVars struct {
Time int64
Diff *big.Int
TxData []string
+ Value *big.Int
}
func NewVm(state *State, stateManager *StateManager, vars RuntimeVars) *Vm {
@@ -324,8 +326,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case oCALLER:
stack.Push(ethutil.BigD(closure.Callee().Address()))
case oCALLVALUE:
- // FIXME: Original value of the call, not the current value
- stack.Push(closure.Value)
+ log.Println("Value:", vm.vars.Value)
+ stack.Push(vm.vars.Value)
case oCALLDATALOAD:
require(1)
offset := stack.Pop().Int64()