diff options
author | Maran <maran.hidskes@gmail.com> | 2014-06-23 22:26:01 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-06-23 22:26:01 +0800 |
commit | bcb88e73528777ac0de489449a8d9045654447d5 (patch) | |
tree | 0731b19e6d8043b84525e2c586dbf0cb39d38600 /ethereum | |
parent | f6aabb7a90903a681eca44976301620756124137 (diff) | |
parent | 176b7802510a667b8973f2be232f7a8213b3474b (diff) | |
download | go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar.gz go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar.bz2 go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar.lz go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar.xz go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.tar.zst go-tangerine-bcb88e73528777ac0de489449a8d9045654447d5.zip |
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
Diffstat (limited to 'ethereum')
-rw-r--r-- | ethereum/javascript_runtime.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ethereum/javascript_runtime.go b/ethereum/javascript_runtime.go index b05d39232..737f7663f 100644 --- a/ethereum/javascript_runtime.go +++ b/ethereum/javascript_runtime.go @@ -138,6 +138,7 @@ func (self *JSRE) initStdFuncs() { eth.Set("require", self.require) eth.Set("stopMining", self.stopMining) eth.Set("startMining", self.startMining) + eth.Set("blockDo", self.execBlock) } /* @@ -207,3 +208,18 @@ func (self *JSRE) require(call otto.FunctionCall) otto.Value { return t } + +func (self *JSRE) execBlock(call otto.FunctionCall) otto.Value { + hash, err := call.Argument(0).ToString() + if err != nil { + return otto.UndefinedValue() + } + + err = self.ethereum.BlockDo(ethutil.FromHex(hash)) + if err != nil { + fmt.Println(err) + return otto.FalseValue() + } + + return otto.TrueValue() +} |