|
|
@ -65,6 +65,10 @@ type Ethereum struct { |
|
|
|
// Specifies the desired amount of maximum peers
|
|
|
|
// Specifies the desired amount of maximum peers
|
|
|
|
MaxPeers int |
|
|
|
MaxPeers int |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mining bool |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listening bool |
|
|
|
|
|
|
|
|
|
|
|
reactor *ethutil.ReactorEngine |
|
|
|
reactor *ethutil.ReactorEngine |
|
|
|
|
|
|
|
|
|
|
|
RpcServer *ethrpc.JsonRpcServer |
|
|
|
RpcServer *ethrpc.JsonRpcServer |
|
|
@ -128,6 +132,15 @@ func (s *Ethereum) TxPool() *ethchain.TxPool { |
|
|
|
func (s *Ethereum) ServerCaps() Caps { |
|
|
|
func (s *Ethereum) ServerCaps() Caps { |
|
|
|
return s.serverCaps |
|
|
|
return s.serverCaps |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Ethereum) IsMining() bool { |
|
|
|
|
|
|
|
return s.Mining |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func (s *Ethereum) PeerCount() int { |
|
|
|
|
|
|
|
return s.peers.Len() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func (s *Ethereum) IsListening() bool { |
|
|
|
|
|
|
|
return s.listening |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (s *Ethereum) AddPeer(conn net.Conn) { |
|
|
|
func (s *Ethereum) AddPeer(conn net.Conn) { |
|
|
|
peer := NewPeer(conn, s, true) |
|
|
|
peer := NewPeer(conn, s, true) |
|
|
@ -305,7 +318,9 @@ func (s *Ethereum) Start(seed bool) { |
|
|
|
ln, err := net.Listen("tcp", ":"+s.Port) |
|
|
|
ln, err := net.Listen("tcp", ":"+s.Port) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Println("Connection listening disabled. Acting as client") |
|
|
|
log.Println("Connection listening disabled. Acting as client") |
|
|
|
|
|
|
|
s.listening = false |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
s.listening = true |
|
|
|
// Starting accepting connections
|
|
|
|
// Starting accepting connections
|
|
|
|
ethutil.Config.Log.Infoln("Ready and accepting connections") |
|
|
|
ethutil.Config.Log.Infoln("Ready and accepting connections") |
|
|
|
// Start the peer handler
|
|
|
|
// Start the peer handler
|
|
|
|