Skip to content

Commit abb9b7f

Browse files
author
Alexandre Van de Sande
committed
Merge branch 'develop' into ui
2 parents fbd5e4d + c934222 commit abb9b7f

File tree

15 files changed

+62
-102
lines changed

15 files changed

+62
-102
lines changed

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND noninteractive
1212
RUN apt-get update && apt-get upgrade -y
1313
RUN apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev
1414

15-
## Install Qt5.4
15+
## Install Qt5.4 (not required for CLI)
1616
# RUN add-apt-repository ppa:beineri/opt-qt54-trusty -y
1717
# RUN apt-get update -y
1818
# 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
2626
ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist
2727

2828
## Fetch and install go-ethereum
29-
RUN go get -u -v -d github.com/ethereum/go-ethereum/...
29+
RUN go get -v github.com/tools/godep
30+
RUN go get -v -d github.com/ethereum/go-ethereum/...
3031
WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum
31-
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
32+
RUN git checkout develop
33+
RUN godep restore
3234
RUN go install -v ./cmd/ethereum
3335

3436
## Run & expose JSON RPC
35-
ENTRYPOINT ["ethereum", "-rpc=true", "-rpcport=8080"]
36-
EXPOSE 8080
37+
ENTRYPOINT ["ethereum", "-rpc=true", "-rpcport=8545"]
38+
EXPOSE 8545
39+
40+

Godeps/Godeps.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/github.com/obscuren/qml/cpp/capi.cpp

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ For further, detailed, build instruction please see the [Wiki](https://github.co
2929
Automated (dev) builds
3030
======================
3131

32+
* [[Docker](https://registry.hub.docker.com/u/ethereum/client-go/)]
3233
* [[OS X](http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg)]
3334
* [Windows] Coming soon™
3435
* [Linux] Coming soon™
@@ -91,6 +92,8 @@ are ignored (use gofmt!). If you send pull requests make absolute sure that you
9192
commit on the `develop` branch and that you do not merge to master.
9293
Commits that are directly based on master are simply ignored.
9394

95+
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.
96+
9497
To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets
9598
this all up and streamlines your work flow.
9699

cmd/mist/ext_app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type AppContainer interface {
4343

4444
type ExtApplication struct {
4545
*xeth.XEth
46-
eth core.EthManager
46+
eth core.Backend
4747

4848
events event.Subscription
4949
watcherQuitChan chan bool

cmd/mist/gui.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
"github.com/ethereum/go-ethereum/ethdb"
4242
"github.com/ethereum/go-ethereum/ethutil"
4343
"github.com/ethereum/go-ethereum/logger"
44-
"github.com/ethereum/go-ethereum/miner"
4544
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
4645
"github.com/ethereum/go-ethereum/xeth"
4746
"github.com/obscuren/qml"
@@ -81,8 +80,6 @@ type Gui struct {
8180
config *ethutil.ConfigManager
8281

8382
plugins map[string]plugin
84-
85-
miner *miner.Miner
8683
}
8784

8885
// Create GUI, but doesn't start it
@@ -454,7 +451,7 @@ func (gui *Gui) update() {
454451
case <-generalUpdateTicker.C:
455452
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String()
456453
lastBlockLabel.Set("text", statusText)
457-
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.HashRate(), 10)+"/Khash")
454+
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
458455

459456
/*
460457
blockLength := gui.eth.BlockPool().BlocksProcessed

cmd/mist/ui_lib.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/ethereum/go-ethereum/ethutil"
3131
"github.com/ethereum/go-ethereum/event/filter"
3232
"github.com/ethereum/go-ethereum/javascript"
33-
"github.com/ethereum/go-ethereum/miner"
3433
"github.com/ethereum/go-ethereum/xeth"
3534
"github.com/obscuren/qml"
3635
)
@@ -56,13 +55,10 @@ type UiLib struct {
5655

5756
filterCallbacks map[int][]int
5857
filterManager *filter.FilterManager
59-
60-
miner *miner.Miner
6158
}
6259

6360
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
6461
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)}
65-
lib.miner = miner.New(eth.KeyManager().Address(), eth)
6662
lib.filterManager = filter.NewFilterManager(eth.EventMux())
6763
go lib.filterManager.Start()
6864

@@ -221,20 +217,20 @@ func (self *UiLib) RemoveLocalTransaction(id int) {
221217
}
222218

223219
func (self *UiLib) SetGasPrice(price string) {
224-
self.miner.MinAcceptedGasPrice = ethutil.Big(price)
220+
self.Miner().MinAcceptedGasPrice = ethutil.Big(price)
225221
}
226222

227223
func (self *UiLib) SetExtra(extra string) {
228-
self.miner.Extra = extra
224+
self.Miner().Extra = extra
229225
}
230226

231227
func (self *UiLib) ToggleMining() bool {
232-
if !self.miner.Mining() {
233-
self.miner.Start()
228+
if !self.Miner().Mining() {
229+
self.Miner().Start()
234230

235231
return true
236232
} else {
237-
self.miner.Stop()
233+
self.Miner().Stop()
238234

239235
return false
240236
}

core/filter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type FilterOptions struct {
2525

2626
// Filtering interface
2727
type Filter struct {
28-
eth EthManager
28+
eth Backend
2929
earliest int64
3030
latest int64
3131
skip int
@@ -40,7 +40,7 @@ type Filter struct {
4040

4141
// Create a new filter which uses a bloom filter on blocks to figure out whether a particular block
4242
// is interesting or not.
43-
func NewFilter(eth EthManager) *Filter {
43+
func NewFilter(eth Backend) *Filter {
4444
return &Filter{eth: eth}
4545
}
4646

core/manager.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import (
77
"github.com/ethereum/go-ethereum/p2p"
88
)
99

10-
type EthManager interface {
10+
type Backend interface {
1111
BlockProcessor() *BlockProcessor
1212
ChainManager() *ChainManager
1313
TxPool() *TxPool
1414
PeerCount() int
15-
IsMining() bool
1615
IsListening() bool
1716
Peers() []*p2p.Peer
1817
KeyManager() *crypto.KeyManager

eth/backend.go

Lines changed: 19 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/ethereum/go-ethereum/ethutil"
1212
"github.com/ethereum/go-ethereum/event"
1313
ethlogger "github.com/ethereum/go-ethereum/logger"
14+
"github.com/ethereum/go-ethereum/miner"
1415
"github.com/ethereum/go-ethereum/p2p"
1516
"github.com/ethereum/go-ethereum/p2p/discover"
1617
"github.com/ethereum/go-ethereum/p2p/nat"
@@ -95,6 +96,7 @@ type Ethereum struct {
9596
eventMux *event.TypeMux
9697
txSub event.Subscription
9798
blockSub event.Subscription
99+
miner *miner.Miner
98100

99101
RpcServer rpc.RpcServer
100102
WsServer rpc.RpcServer
@@ -151,6 +153,7 @@ func New(config *Config) (*Ethereum, error) {
151153
eth.blockProcessor = core.NewBlockProcessor(db, eth.txPool, eth.chainManager, eth.EventMux())
152154
eth.chainManager.SetProcessor(eth.blockProcessor)
153155
eth.whisper = whisper.New()
156+
eth.miner = miner.New(keyManager.Address(), eth)
154157

155158
hasBlock := eth.chainManager.HasBlock
156159
insertChain := eth.chainManager.InsertChain
@@ -181,69 +184,22 @@ func New(config *Config) (*Ethereum, error) {
181184
return eth, nil
182185
}
183186

184-
func (s *Ethereum) KeyManager() *crypto.KeyManager {
185-
return s.keyManager
186-
}
187-
188-
func (s *Ethereum) Logger() ethlogger.LogSystem {
189-
return s.logger
190-
}
191-
192-
func (s *Ethereum) Name() string {
193-
return s.net.Name
194-
}
195-
196-
func (s *Ethereum) ChainManager() *core.ChainManager {
197-
return s.chainManager
198-
}
199-
200-
func (s *Ethereum) BlockProcessor() *core.BlockProcessor {
201-
return s.blockProcessor
202-
}
203-
204-
func (s *Ethereum) TxPool() *core.TxPool {
205-
return s.txPool
206-
}
207-
208-
func (s *Ethereum) BlockPool() *BlockPool {
209-
return s.blockPool
210-
}
211-
212-
func (s *Ethereum) Whisper() *whisper.Whisper {
213-
return s.whisper
214-
}
215-
216-
func (s *Ethereum) EventMux() *event.TypeMux {
217-
return s.eventMux
218-
}
219-
func (self *Ethereum) Db() ethutil.Database {
220-
return self.db
221-
}
222-
223-
func (s *Ethereum) IsMining() bool {
224-
return s.Mining
225-
}
226-
227-
func (s *Ethereum) IsListening() bool {
228-
// XXX TODO
229-
return false
230-
}
231-
232-
func (s *Ethereum) PeerCount() int {
233-
return s.net.PeerCount()
234-
}
235-
236-
func (s *Ethereum) Peers() []*p2p.Peer {
237-
return s.net.Peers()
238-
}
239-
240-
func (s *Ethereum) MaxPeers() int {
241-
return s.net.MaxPeers
242-
}
243-
244-
func (s *Ethereum) Coinbase() []byte {
245-
return nil // TODO
246-
}
187+
func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager }
188+
func (s *Ethereum) Logger() ethlogger.LogSystem { return s.logger }
189+
func (s *Ethereum) Name() string { return s.net.Name }
190+
func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }
191+
func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor }
192+
func (s *Ethereum) TxPool() *core.TxPool { return s.txPool }
193+
func (s *Ethereum) BlockPool() *BlockPool { return s.blockPool }
194+
func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper }
195+
func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux }
196+
func (s *Ethereum) Db() ethutil.Database { return s.db }
197+
func (s *Ethereum) Miner() *miner.Miner { return s.miner }
198+
func (s *Ethereum) IsListening() bool { return true } // Always listening
199+
func (s *Ethereum) PeerCount() int { return s.net.PeerCount() }
200+
func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() }
201+
func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers }
202+
func (s *Ethereum) Coinbase() []byte { return nil } // TODO
247203

248204
// Start the ethereum
249205
func (s *Ethereum) Start() error {

0 commit comments

Comments
 (0)