aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/javascript_runtime.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-26 06:41:55 +0800
committerobscuren <geffobscura@gmail.com>2014-05-26 06:41:55 +0800
commit0d89c1d212e121b4904bf24b5332de9d4344334b (patch)
treeb6499be349d9950ba083e211ebb787294fbf413c /ethereum/javascript_runtime.go
parent7f1a4c377c18055137909521d809251248b7b5af (diff)
parent818bc84591c490b29cb28ee1e4895c8f303a0af1 (diff)
downloadgo-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar.gz
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar.bz2
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar.lz
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar.xz
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.tar.zst
go-tangerine-0d89c1d212e121b4904bf24b5332de9d4344334b.zip
Merge branch 'release/poc5-rc9'poc5-rc9
Diffstat (limited to 'ethereum/javascript_runtime.go')
-rw-r--r--ethereum/javascript_runtime.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/ethereum/javascript_runtime.go b/ethereum/javascript_runtime.go
index fa01c7005..93297f604 100644
--- a/ethereum/javascript_runtime.go
+++ b/ethereum/javascript_runtime.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
+ "github.com/ethereum/go-ethereum/utils"
"github.com/obscuren/otto"
"io/ioutil"
"os"
@@ -116,14 +117,26 @@ func (self *JSRE) initStdFuncs() {
eth.Set("watch", self.watch)
eth.Set("addPeer", self.addPeer)
eth.Set("require", self.require)
+ eth.Set("stopMining", self.stopMining)
+ eth.Set("startMining", self.startMining)
}
/*
* The following methods are natively implemented javascript functions
*/
+func (self *JSRE) stopMining(call otto.FunctionCall) otto.Value {
+ v, _ := self.vm.ToValue(utils.StopMining(self.ethereum))
+ return v
+}
+
+func (self *JSRE) startMining(call otto.FunctionCall) otto.Value {
+ v, _ := self.vm.ToValue(utils.StartMining(self.ethereum))
+ return v
+}
+
// eth.watch
-func (self JSRE) watch(call otto.FunctionCall) otto.Value {
+func (self *JSRE) watch(call otto.FunctionCall) otto.Value {
addr, _ := call.Argument(0).ToString()
var storageAddr string
var cb otto.Value