aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-23 19:30:30 +0800
committerzelig <viktor.tron@gmail.com>2014-06-23 19:30:30 +0800
commit34284b7532e753b7fe67a11d8fe19ba4afd9066f (patch)
tree59e13724f8a612b0ee8ffe6c24a3e9b4d573be36
parent1024766514eea7bb628ec6e5ed974e997b8faefc (diff)
parent176b7802510a667b8973f2be232f7a8213b3474b (diff)
downloadgo-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar.gz
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar.bz2
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar.lz
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar.xz
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.tar.zst
go-tangerine-34284b7532e753b7fe67a11d8fe19ba4afd9066f.zip
merge upstream
-rw-r--r--ethereum/javascript_runtime.go18
-rw-r--r--utils/cmd.go3
2 files changed, 17 insertions, 4 deletions
diff --git a/ethereum/javascript_runtime.go b/ethereum/javascript_runtime.go
index 34b805e7f..ac05be69b 100644
--- a/ethereum/javascript_runtime.go
+++ b/ethereum/javascript_runtime.go
@@ -1,4 +1,4 @@
-package main
+ package main
import (
"fmt"
@@ -144,6 +144,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)
}
/*
@@ -213,3 +214,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()
+}
diff --git a/utils/cmd.go b/utils/cmd.go
index 39233d586..8bc9c63fa 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -198,9 +198,6 @@ func StartMining(ethereum *eth.Ethereum) bool {
miner = ethminer.NewDefaultMiner(addr, ethereum)
// Give it some time to connect with peers
time.Sleep(3 * time.Second)
- for ethereum.IsUpToDate() == false {
- time.Sleep(5 * time.Second)
- }
logger.Infoln("Miner started")
miner := ethminer.NewDefaultMiner(addr, ethereum)
miner.Start()