aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-13 20:43:29 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-13 20:43:29 +0800
commit28357d657b8c46e841fc96a61758652d2617b068 (patch)
treecf0f61c753f50087029c96f3499b722894edd2b3 /ethereum.go
parent8ec1bb382aade4aaba20b7fd051a7e52cee61d6e (diff)
downloadgo-tangerine-28357d657b8c46e841fc96a61758652d2617b068.tar.gz
go-tangerine-28357d657b8c46e841fc96a61758652d2617b068.tar.zst
go-tangerine-28357d657b8c46e841fc96a61758652d2617b068.zip
Implemented new JS/EthPub methods
- getTxCountAt - getPeerCount - getIsMining - getIsListening - getCoinbase
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ethereum.go b/ethereum.go
index 92c4e4ba1..94e338c56 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -65,6 +65,10 @@ type Ethereum struct {
// Specifies the desired amount of maximum peers
MaxPeers int
+ Mining bool
+
+ listening bool
+
reactor *ethutil.ReactorEngine
RpcServer *ethrpc.JsonRpcServer
@@ -128,6 +132,15 @@ func (s *Ethereum) TxPool() *ethchain.TxPool {
func (s *Ethereum) ServerCaps() Caps {
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) {
peer := NewPeer(conn, s, true)
@@ -305,7 +318,9 @@ func (s *Ethereum) Start(seed bool) {
ln, err := net.Listen("tcp", ":"+s.Port)
if err != nil {
log.Println("Connection listening disabled. Acting as client")
+ s.listening = false
} else {
+ s.listening = true
// Starting accepting connections
ethutil.Config.Log.Infoln("Ready and accepting connections")
// Start the peer handler