aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-13 08:20:46 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-13 08:20:46 +0800
commitd4ed66c83df40c6d3035e21c705b4ca06e52a0be (patch)
tree0ef17bb9e6676994a7bfa2d39927dc9088b8f072
parent094f921e5028fc215efbc86118e3d3e5b0663055 (diff)
downloaddexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar.gz
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar.bz2
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar.lz
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar.xz
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.tar.zst
dexon-d4ed66c83df40c6d3035e21c705b4ca06e52a0be.zip
Add web3_clientVersion
-rw-r--r--eth/backend.go3
-rw-r--r--rpc/api.go14
-rw-r--r--xeth/xeth.go1
3 files changed, 11 insertions, 7 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 6fd211b35..bb203b4a6 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -131,6 +131,7 @@ type Ethereum struct {
Mining bool
DataDir string
+ version string
}
func New(config *Config) (*Ethereum, error) {
@@ -165,6 +166,7 @@ func New(config *Config) (*Ethereum, error) {
logger: servlogger,
accountManager: config.AccountManager,
DataDir: config.DataDir,
+ version: config.Name, // TODO should separate from Name
}
eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.EventMux())
@@ -236,6 +238,7 @@ 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 }
// Start the ethereum
func (s *Ethereum) Start() error {
diff --git a/rpc/api.go b/rpc/api.go
index b72a0dd60..05f4d0bc4 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -477,6 +477,10 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
*reply = toHex(crypto.Sha3(fromHex(args.Data)))
+ case "web3_clientVersion":
+ *reply = p.xeth().Backend().Version()
+ case "net_version":
+ return NewNotImplementedError(req.Method)
case "net_listening":
*reply = p.xeth().IsListening()
case "net_peerCount":
@@ -675,9 +679,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
*reply = uncle
case "eth_getCompilers":
return p.GetCompilers(reply)
- case "eth_compileSolidity":
- case "eth_compileLLL":
- case "eth_compileSerpent":
+ case "eth_compileSolidity", "eth_compileLLL", "eth_compileSerpent":
return NewNotImplementedError(req.Method)
case "eth_newFilter":
args := new(FilterOptions)
@@ -715,8 +717,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
return p.AllLogs(args, reply)
- case "eth_getWork":
- case "eth_submitWork":
+ case "eth_getWork", "eth_submitWork":
return NewNotImplementedError(req.Method)
case "db_put":
args := new(DbArgs)
@@ -744,8 +745,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
return p.HasWhisperIdentity(args.Identity, reply)
- case "shh_newGroup":
- case "shh_addToGroup":
+ case "shh_newGroup", "shh_addToGroup":
return NewNotImplementedError(req.Method)
case "shh_newFilter":
args := new(WhisperFilterArgs)
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 4c28caf86..7f89cbb2e 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -39,6 +39,7 @@ type Backend interface {
IsMining() bool
StartMining() error
StopMining()
+ Version() string
}
// Frontend should be implemented by users of XEth. Its methods are