diff options
author | Alexandre Van de Sande <alex.vandesande@ethdev.com> | 2015-02-17 19:29:10 +0800 |
---|---|---|
committer | Alexandre Van de Sande <alex.vandesande@ethdev.com> | 2015-02-17 19:29:10 +0800 |
commit | abb9b7f46ff3b2ef0bb4f2e95f029591688768c4 (patch) | |
tree | c4088c788b3e86935a2b8fd2fbe157340476f091 | |
parent | fbd5e4d5afeaff6c250a3a953b18476cdb4b86ae (diff) | |
parent | c934222a8089b19587242a3b0bc71ea0aec1d5ef (diff) | |
download | go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.gz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.bz2 go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.lz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.xz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.zst go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.zip |
Merge branch 'develop' into ui
-rw-r--r-- | Dockerfile | 14 | ||||
-rw-r--r-- | Godeps/Godeps.json | 2 | ||||
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp | 2 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | cmd/mist/ext_app.go | 2 | ||||
-rw-r--r-- | cmd/mist/gui.go | 5 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 14 | ||||
-rw-r--r-- | core/filter.go | 4 | ||||
-rw-r--r-- | core/manager.go | 3 | ||||
-rw-r--r-- | eth/backend.go | 82 | ||||
-rw-r--r-- | miner/miner.go | 8 | ||||
-rw-r--r-- | miner/worker.go | 7 | ||||
-rw-r--r-- | ui/filter.go | 2 | ||||
-rw-r--r-- | ui/qt/filter.go | 2 | ||||
-rw-r--r-- | xeth/xeth.go | 14 |
15 files changed, 62 insertions, 102 deletions
diff --git a/Dockerfile b/Dockerfile index 907b96c21..1f6555d1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get upgrade -y RUN apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev -## Install Qt5.4 +## Install Qt5.4 (not required for CLI) # RUN add-apt-repository ppa:beineri/opt-qt54-trusty -y # RUN apt-get update -y # RUN apt-get install -y qt54quickcontrols qt54webengine mesa-common-dev libglu1-mesa-dev @@ -26,11 +26,15 @@ RUN tar -C /usr/local -xzf go*.tar.gz && go version ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist ## Fetch and install go-ethereum -RUN go get -u -v -d github.com/ethereum/go-ethereum/... +RUN go get -v github.com/tools/godep +RUN go get -v -d github.com/ethereum/go-ethereum/... WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum -RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi +RUN git checkout develop +RUN godep restore RUN go install -v ./cmd/ethereum ## Run & expose JSON RPC -ENTRYPOINT ["ethereum", "-rpc=true", "-rpcport=8080"] -EXPOSE 8080 +ENTRYPOINT ["ethereum", "-rpc=true", "-rpcport=8545"] +EXPOSE 8545 + + diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 1ecdce06f..831140690 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -67,7 +67,7 @@ }, { "ImportPath": "github.com/obscuren/qml", - "Rev": "807b51d4104231784fa5e336ccd26d61759a3cb2" + "Rev": "c288002b52e905973b131089a8a7c761d4a2c36a" }, { "ImportPath": "github.com/rakyll/globalconf", diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp b/Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp index c2255aaae..024e5ec9c 100644 --- a/Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp +++ b/Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp @@ -855,6 +855,8 @@ QQmlListProperty_ *newListProperty(GoAddr *addr, intptr_t reflectIndex, intptr_t void internalLogHandler(QtMsgType severity, const QMessageLogContext &context, const QString &text) { + if (context.file == NULL) return; + QByteArray textba = text.toUtf8(); LogMessage message = {severity, textba.constData(), textba.size(), context.file, (int)strlen(context.file), context.line}; hookLogHandler(&message); @@ -29,6 +29,7 @@ For further, detailed, build instruction please see the [Wiki](https://github.co Automated (dev) builds ====================== +* [[Docker](https://registry.hub.docker.com/u/ethereum/client-go/)] * [[OS X](http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg)] * [Windows] Coming soon™ * [Linux] Coming soon™ @@ -91,6 +92,8 @@ are ignored (use gofmt!). If you send pull requests make absolute sure that you commit on the `develop` branch and that you do not merge to master. Commits that are directly based on master are simply ignored. +For dependency management, we use [godep](https://github.com/tools/godep). After installing with `go get github.com/tools/godep`, run `godep restore` to ensure that changes to other repositories do not break the build. To update a dependency version (for example, to include a new upstream fix), run `go get -u <foo/bar>` then `godep update <foo/...>`. To track a new dependency, add it to the project as normal than run `godep save ./...`. Changes to the Godeps folder should be manually verified then commited. + To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets this all up and streamlines your work flow. diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 4831884e5..7ac51db0b 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -43,7 +43,7 @@ type AppContainer interface { type ExtApplication struct { *xeth.XEth - eth core.EthManager + eth core.Backend events event.Subscription watcherQuitChan chan bool diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 208b553d2..9ce6ba650 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -41,7 +41,6 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/ui/qt/qwhisper" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" @@ -81,8 +80,6 @@ type Gui struct { config *ethutil.ConfigManager plugins map[string]plugin - - miner *miner.Miner } // Create GUI, but doesn't start it @@ -454,7 +451,7 @@ func (gui *Gui) update() { case <-generalUpdateTicker.C: statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String() lastBlockLabel.Set("text", statusText) - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.HashRate(), 10)+"/Khash") + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash") /* blockLength := gui.eth.BlockPool().BlocksProcessed diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 368fb002b..1a4d21012 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -30,7 +30,6 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" - "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -56,13 +55,10 @@ type UiLib struct { filterCallbacks map[int][]int filterManager *filter.FilterManager - - miner *miner.Miner } func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { lib := &UiLib{XEth: xeth.New(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} - lib.miner = miner.New(eth.KeyManager().Address(), eth) lib.filterManager = filter.NewFilterManager(eth.EventMux()) go lib.filterManager.Start() @@ -221,20 +217,20 @@ func (self *UiLib) RemoveLocalTransaction(id int) { } func (self *UiLib) SetGasPrice(price string) { - self.miner.MinAcceptedGasPrice = ethutil.Big(price) + self.Miner().MinAcceptedGasPrice = ethutil.Big(price) } func (self *UiLib) SetExtra(extra string) { - self.miner.Extra = extra + self.Miner().Extra = extra } func (self *UiLib) ToggleMining() bool { - if !self.miner.Mining() { - self.miner.Start() + if !self.Miner().Mining() { + self.Miner().Start() return true } else { - self.miner.Stop() + self.Miner().Stop() return false } diff --git a/core/filter.go b/core/filter.go index b93fcc8a5..234fa3316 100644 --- a/core/filter.go +++ b/core/filter.go @@ -25,7 +25,7 @@ type FilterOptions struct { // Filtering interface type Filter struct { - eth EthManager + eth Backend earliest int64 latest int64 skip int @@ -40,7 +40,7 @@ type Filter struct { // Create a new filter which uses a bloom filter on blocks to figure out whether a particular block // is interesting or not. -func NewFilter(eth EthManager) *Filter { +func NewFilter(eth Backend) *Filter { return &Filter{eth: eth} } diff --git a/core/manager.go b/core/manager.go index f960fc5f0..bb039d063 100644 --- a/core/manager.go +++ b/core/manager.go @@ -7,12 +7,11 @@ import ( "github.com/ethereum/go-ethereum/p2p" ) -type EthManager interface { +type Backend interface { BlockProcessor() *BlockProcessor ChainManager() *ChainManager TxPool() *TxPool PeerCount() int - IsMining() bool IsListening() bool Peers() []*p2p.Peer KeyManager() *crypto.KeyManager diff --git a/eth/backend.go b/eth/backend.go index 8c2073574..690c7136d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" ethlogger "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" @@ -95,6 +96,7 @@ type Ethereum struct { eventMux *event.TypeMux txSub event.Subscription blockSub event.Subscription + miner *miner.Miner RpcServer rpc.RpcServer WsServer rpc.RpcServer @@ -151,6 +153,7 @@ func New(config *Config) (*Ethereum, error) { eth.blockProcessor = core.NewBlockProcessor(db, eth.txPool, eth.chainManager, eth.EventMux()) eth.chainManager.SetProcessor(eth.blockProcessor) eth.whisper = whisper.New() + eth.miner = miner.New(keyManager.Address(), eth) hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain @@ -181,69 +184,22 @@ func New(config *Config) (*Ethereum, error) { return eth, nil } -func (s *Ethereum) KeyManager() *crypto.KeyManager { - return s.keyManager -} - -func (s *Ethereum) Logger() ethlogger.LogSystem { - return s.logger -} - -func (s *Ethereum) Name() string { - return s.net.Name -} - -func (s *Ethereum) ChainManager() *core.ChainManager { - return s.chainManager -} - -func (s *Ethereum) BlockProcessor() *core.BlockProcessor { - return s.blockProcessor -} - -func (s *Ethereum) TxPool() *core.TxPool { - return s.txPool -} - -func (s *Ethereum) BlockPool() *BlockPool { - return s.blockPool -} - -func (s *Ethereum) Whisper() *whisper.Whisper { - return s.whisper -} - -func (s *Ethereum) EventMux() *event.TypeMux { - return s.eventMux -} -func (self *Ethereum) Db() ethutil.Database { - return self.db -} - -func (s *Ethereum) IsMining() bool { - return s.Mining -} - -func (s *Ethereum) IsListening() bool { - // XXX TODO - return false -} - -func (s *Ethereum) PeerCount() int { - return s.net.PeerCount() -} - -func (s *Ethereum) Peers() []*p2p.Peer { - return s.net.Peers() -} - -func (s *Ethereum) MaxPeers() int { - return s.net.MaxPeers -} - -func (s *Ethereum) Coinbase() []byte { - return nil // TODO -} +func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager } +func (s *Ethereum) Logger() ethlogger.LogSystem { return s.logger } +func (s *Ethereum) Name() string { return s.net.Name } +func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager } +func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor } +func (s *Ethereum) TxPool() *core.TxPool { return s.txPool } +func (s *Ethereum) BlockPool() *BlockPool { return s.blockPool } +func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper } +func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } +func (s *Ethereum) Db() ethutil.Database { return s.db } +func (s *Ethereum) Miner() *miner.Miner { return s.miner } +func (s *Ethereum) IsListening() bool { return true } // Always listening +func (s *Ethereum) PeerCount() int { return s.net.PeerCount() } +func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } +func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers } +func (s *Ethereum) Coinbase() []byte { return nil } // TODO // Start the ethereum func (s *Ethereum) Start() error { diff --git a/miner/miner.go b/miner/miner.go index e3e7bead2..27afcf684 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -3,7 +3,7 @@ package miner import ( "math/big" - "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/pow/ezp" ) @@ -16,13 +16,13 @@ type Miner struct { MinAcceptedGasPrice *big.Int Extra string - coinbase []byte + Coinbase []byte mining bool } -func New(coinbase []byte, eth *eth.Ethereum) *Miner { +func New(coinbase []byte, eth core.Backend) *Miner { miner := &Miner{ - coinbase: coinbase, + Coinbase: coinbase, worker: newWorker(coinbase, eth), } diff --git a/miner/worker.go b/miner/worker.go index 2b64f3210..47b462e53 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/pow" @@ -25,7 +24,7 @@ type environment struct { uncles *set.Set } -func env(block *types.Block, eth *eth.Ethereum) *environment { +func env(block *types.Block, eth core.Backend) *environment { state := state.New(block.Root(), eth.Db()) env := &environment{ totalUsedGas: new(big.Int), @@ -63,7 +62,7 @@ type worker struct { quit chan struct{} pow pow.PoW - eth *eth.Ethereum + eth core.Backend chain *core.ChainManager proc *core.BlockProcessor coinbase []byte @@ -73,7 +72,7 @@ type worker struct { mining bool } -func newWorker(coinbase []byte, eth *eth.Ethereum) *worker { +func newWorker(coinbase []byte, eth core.Backend) *worker { return &worker{ eth: eth, mux: eth.EventMux(), diff --git a/ui/filter.go b/ui/filter.go index 8f298a40c..da2ea0edb 100644 --- a/ui/filter.go +++ b/ui/filter.go @@ -15,7 +15,7 @@ func fromHex(s string) []byte { return nil } -func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter { +func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter { filter := core.NewFilter(eth) if object["earliest"] != nil { diff --git a/ui/qt/filter.go b/ui/qt/filter.go index bd3ad0303..48e8a7fae 100644 --- a/ui/qt/filter.go +++ b/ui/qt/filter.go @@ -6,7 +6,7 @@ import ( "github.com/obscuren/qml" ) -func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter { +func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter { filter := ui.NewFilterFromMap(object, eth) if object["topics"] != nil { diff --git a/xeth/xeth.go b/xeth/xeth.go index 75d83f80b..27435b956 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/whisper" @@ -27,13 +28,13 @@ type Backend interface { ChainManager() *core.ChainManager TxPool() *core.TxPool PeerCount() int - IsMining() bool IsListening() bool Peers() []*p2p.Peer KeyManager() *crypto.KeyManager Db() ethutil.Database EventMux() *event.TypeMux Whisper() *whisper.Whisper + Miner() *miner.Miner } type XEth struct { @@ -42,6 +43,7 @@ type XEth struct { chainManager *core.ChainManager state *State whisper *Whisper + miner *miner.Miner } func New(eth Backend) *XEth { @@ -50,15 +52,17 @@ func New(eth Backend) *XEth { blockProcessor: eth.BlockProcessor(), chainManager: eth.ChainManager(), whisper: NewWhisper(eth.Whisper()), + miner: eth.Miner(), } xeth.state = NewState(xeth) return xeth } -func (self *XEth) Backend() Backend { return self.eth } -func (self *XEth) State() *State { return self.state } -func (self *XEth) Whisper() *Whisper { return self.whisper } +func (self *XEth) Backend() Backend { return self.eth } +func (self *XEth) State() *State { return self.state } +func (self *XEth) Whisper() *Whisper { return self.whisper } +func (self *XEth) Miner() *miner.Miner { return self.miner } func (self *XEth) BlockByHash(strHash string) *Block { hash := fromHex(strHash) @@ -96,7 +100,7 @@ func (self *XEth) PeerCount() int { } func (self *XEth) IsMining() bool { - return self.eth.IsMining() + return self.miner.Mining() } func (self *XEth) IsListening() bool { |