aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-03-25 20:55:46 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-03-25 20:55:46 +0800
commitaa1eae67ecd8a85a043f49e36e33bd3c44a1d94c (patch)
tree836fbfcb33ee385a19f0e5e529262efb0a905995 /eth/backend.go
parent7f0c2545a91fd2dce0fea8078222a80dccd8b42b (diff)
parent2b93843d86532db3d6b530daf15c04fde0b73eba (diff)
downloadgo-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar.gz
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar.bz2
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar.lz
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar.xz
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.tar.zst
go-tangerine-aa1eae67ecd8a85a043f49e36e33bd3c44a1d94c.zip
Merge pull request #560 from tgerring/xethcleanup
XEth cleanup
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go39
1 files changed, 21 insertions, 18 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 3fa10086a..c73e76792 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -138,11 +138,12 @@ type Ethereum struct {
// logger logger.LogSystem
- Mining bool
- DataDir string
- version string
- protocolVersion int
- networkId int
+ Mining bool
+ DataDir string
+ clientVersion string
+ ethVersionId int
+ netVersionId int
+ shhVersionId int
}
func New(config *Config) (*Ethereum, error) {
@@ -177,16 +178,16 @@ func New(config *Config) (*Ethereum, error) {
servlogger.Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId)
eth := &Ethereum{
- shutdownChan: make(chan bool),
- blockDb: blockDb,
- stateDb: stateDb,
- extraDb: extraDb,
- eventMux: &event.TypeMux{},
- accountManager: config.AccountManager,
- DataDir: config.DataDir,
- version: config.Name, // TODO should separate from Name
- protocolVersion: config.ProtocolVersion,
- networkId: config.NetworkId,
+ shutdownChan: make(chan bool),
+ blockDb: blockDb,
+ stateDb: stateDb,
+ extraDb: extraDb,
+ eventMux: &event.TypeMux{},
+ accountManager: config.AccountManager,
+ DataDir: config.DataDir,
+ clientVersion: config.Name, // TODO should separate from Name
+ ethVersionId: config.ProtocolVersion,
+ netVersionId: config.NetworkId,
}
eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.EventMux())
@@ -195,6 +196,7 @@ func New(config *Config) (*Ethereum, error) {
eth.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.txPool, eth.chainManager, eth.EventMux())
eth.chainManager.SetProcessor(eth.blockProcessor)
eth.whisper = whisper.New()
+ eth.shhVersionId = int(eth.whisper.Version())
eth.miner = miner.New(eth, eth.pow, config.MinerThreads)
hasBlock := eth.chainManager.HasBlock
@@ -324,9 +326,10 @@ func (s *Ethereum) IsListening() bool { return true } // Alwa
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) Version() string { return s.version }
-func (s *Ethereum) ProtocolVersion() int { return s.protocolVersion }
-func (s *Ethereum) NetworkId() int { return s.networkId }
+func (s *Ethereum) ClientVersion() string { return s.clientVersion }
+func (s *Ethereum) EthVersion() int { return s.ethVersionId }
+func (s *Ethereum) NetVersion() int { return s.netVersionId }
+func (s *Ethereum) ShhVersion() int { return s.shhVersionId }
// Start the ethereum
func (s *Ethereum) Start() error {