Add web3_clientVersion

This commit is contained in:
Taylor Gerring 2015-03-12 19:20:46 -05:00
parent 094f921e50
commit d4ed66c83d
3 changed files with 11 additions and 7 deletions

View File

@ -131,6 +131,7 @@ type Ethereum struct {
Mining bool Mining bool
DataDir string DataDir string
version string
} }
func New(config *Config) (*Ethereum, error) { func New(config *Config) (*Ethereum, error) {
@ -165,6 +166,7 @@ func New(config *Config) (*Ethereum, error) {
logger: servlogger, logger: servlogger,
accountManager: config.AccountManager, accountManager: config.AccountManager,
DataDir: config.DataDir, DataDir: config.DataDir,
version: config.Name, // TODO should separate from Name
} }
eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.EventMux()) 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) 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 }
// Start the ethereum // Start the ethereum
func (s *Ethereum) Start() error { func (s *Ethereum) Start() error {

View File

@ -477,6 +477,10 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err return err
} }
*reply = toHex(crypto.Sha3(fromHex(args.Data))) *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": case "net_listening":
*reply = p.xeth().IsListening() *reply = p.xeth().IsListening()
case "net_peerCount": case "net_peerCount":
@ -675,9 +679,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
*reply = uncle *reply = uncle
case "eth_getCompilers": case "eth_getCompilers":
return p.GetCompilers(reply) return p.GetCompilers(reply)
case "eth_compileSolidity": case "eth_compileSolidity", "eth_compileLLL", "eth_compileSerpent":
case "eth_compileLLL":
case "eth_compileSerpent":
return NewNotImplementedError(req.Method) return NewNotImplementedError(req.Method)
case "eth_newFilter": case "eth_newFilter":
args := new(FilterOptions) args := new(FilterOptions)
@ -715,8 +717,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err return err
} }
return p.AllLogs(args, reply) return p.AllLogs(args, reply)
case "eth_getWork": case "eth_getWork", "eth_submitWork":
case "eth_submitWork":
return NewNotImplementedError(req.Method) return NewNotImplementedError(req.Method)
case "db_put": case "db_put":
args := new(DbArgs) args := new(DbArgs)
@ -744,8 +745,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err return err
} }
return p.HasWhisperIdentity(args.Identity, reply) return p.HasWhisperIdentity(args.Identity, reply)
case "shh_newGroup": case "shh_newGroup", "shh_addToGroup":
case "shh_addToGroup":
return NewNotImplementedError(req.Method) return NewNotImplementedError(req.Method)
case "shh_newFilter": case "shh_newFilter":
args := new(WhisperFilterArgs) args := new(WhisperFilterArgs)

View File

@ -39,6 +39,7 @@ type Backend interface {
IsMining() bool IsMining() bool
StartMining() error StartMining() error
StopMining() StopMining()
Version() string
} }
// Frontend should be implemented by users of XEth. Its methods are // Frontend should be implemented by users of XEth. Its methods are