|
|
@ -138,11 +138,12 @@ type Ethereum struct { |
|
|
|
|
|
|
|
|
|
|
|
// logger logger.LogSystem
|
|
|
|
// logger logger.LogSystem
|
|
|
|
|
|
|
|
|
|
|
|
Mining bool |
|
|
|
Mining bool |
|
|
|
DataDir string |
|
|
|
DataDir string |
|
|
|
version string |
|
|
|
clientVersion string |
|
|
|
protocolVersion int |
|
|
|
ethVersionId int |
|
|
|
networkId int |
|
|
|
netVersionId int |
|
|
|
|
|
|
|
shhVersionId int |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func New(config *Config) (*Ethereum, error) { |
|
|
|
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) |
|
|
|
servlogger.Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId) |
|
|
|
|
|
|
|
|
|
|
|
eth := &Ethereum{ |
|
|
|
eth := &Ethereum{ |
|
|
|
shutdownChan: make(chan bool), |
|
|
|
shutdownChan: make(chan bool), |
|
|
|
blockDb: blockDb, |
|
|
|
blockDb: blockDb, |
|
|
|
stateDb: stateDb, |
|
|
|
stateDb: stateDb, |
|
|
|
extraDb: extraDb, |
|
|
|
extraDb: extraDb, |
|
|
|
eventMux: &event.TypeMux{}, |
|
|
|
eventMux: &event.TypeMux{}, |
|
|
|
accountManager: config.AccountManager, |
|
|
|
accountManager: config.AccountManager, |
|
|
|
DataDir: config.DataDir, |
|
|
|
DataDir: config.DataDir, |
|
|
|
version: config.Name, // TODO should separate from Name
|
|
|
|
clientVersion: config.Name, // TODO should separate from Name
|
|
|
|
protocolVersion: config.ProtocolVersion, |
|
|
|
ethVersionId: config.ProtocolVersion, |
|
|
|
networkId: config.NetworkId, |
|
|
|
netVersionId: config.NetworkId, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.EventMux()) |
|
|
|
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.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.txPool, eth.chainManager, eth.EventMux()) |
|
|
|
eth.chainManager.SetProcessor(eth.blockProcessor) |
|
|
|
eth.chainManager.SetProcessor(eth.blockProcessor) |
|
|
|
eth.whisper = whisper.New() |
|
|
|
eth.whisper = whisper.New() |
|
|
|
|
|
|
|
eth.shhVersionId = int(eth.whisper.Version()) |
|
|
|
eth.miner = miner.New(eth, eth.pow, config.MinerThreads) |
|
|
|
eth.miner = miner.New(eth, eth.pow, config.MinerThreads) |
|
|
|
|
|
|
|
|
|
|
|
hasBlock := eth.chainManager.HasBlock |
|
|
|
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) PeerCount() int { return s.net.PeerCount() } |
|
|
|
func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } |
|
|
|
func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } |
|
|
|
func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers } |
|
|
|
func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers } |
|
|
|
func (s *Ethereum) Version() string { return s.version } |
|
|
|
func (s *Ethereum) ClientVersion() string { return s.clientVersion } |
|
|
|
func (s *Ethereum) ProtocolVersion() int { return s.protocolVersion } |
|
|
|
func (s *Ethereum) EthVersion() int { return s.ethVersionId } |
|
|
|
func (s *Ethereum) NetworkId() int { return s.networkId } |
|
|
|
func (s *Ethereum) NetVersion() int { return s.netVersionId } |
|
|
|
|
|
|
|
func (s *Ethereum) ShhVersion() int { return s.shhVersionId } |
|
|
|
|
|
|
|
|
|
|
|
// Start the ethereum
|
|
|
|
// Start the ethereum
|
|
|
|
func (s *Ethereum) Start() error { |
|
|
|
func (s *Ethereum) Start() error { |
|
|
|