|
|
@ -6,6 +6,7 @@ import ( |
|
|
|
"github.com/ethereum/eth-go/ethchain" |
|
|
|
"github.com/ethereum/eth-go/ethchain" |
|
|
|
"github.com/ethereum/eth-go/ethpub" |
|
|
|
"github.com/ethereum/eth-go/ethpub" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
|
|
|
|
"github.com/ethereum/eth-go/ethlog" |
|
|
|
"github.com/ethereum/go-ethereum/utils" |
|
|
|
"github.com/ethereum/go-ethereum/utils" |
|
|
|
"github.com/obscuren/otto" |
|
|
|
"github.com/obscuren/otto" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
@ -14,6 +15,8 @@ import ( |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jsrelogger = ethlog.NewLogger("JSRE") |
|
|
|
|
|
|
|
|
|
|
|
type JSRE struct { |
|
|
|
type JSRE struct { |
|
|
|
ethereum *eth.Ethereum |
|
|
|
ethereum *eth.Ethereum |
|
|
|
vm *otto.Otto |
|
|
|
vm *otto.Otto |
|
|
@ -31,7 +34,7 @@ func (jsre *JSRE) LoadExtFile(path string) { |
|
|
|
if err == nil { |
|
|
|
if err == nil { |
|
|
|
jsre.vm.Run(result) |
|
|
|
jsre.vm.Run(result) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ethutil.Config.Log.Debugln("Could not load file:", path) |
|
|
|
jsrelogger.Debugln("Could not load file:", path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -65,6 +68,8 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE { |
|
|
|
|
|
|
|
|
|
|
|
re.initStdFuncs() |
|
|
|
re.initStdFuncs() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsrelogger.Infoln("started") |
|
|
|
|
|
|
|
|
|
|
|
return re |
|
|
|
return re |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -99,6 +104,7 @@ func (self *JSRE) Stop() { |
|
|
|
close(self.blockChan) |
|
|
|
close(self.blockChan) |
|
|
|
close(self.quitChan) |
|
|
|
close(self.quitChan) |
|
|
|
close(self.changeChan) |
|
|
|
close(self.changeChan) |
|
|
|
|
|
|
|
jsrelogger.Infoln("stopped") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (self *JSRE) mainLoop() { |
|
|
|
func (self *JSRE) mainLoop() { |
|
|
|