forked from cerc-io/plugeth
Add client_version RPC message
This commit is contained in:
parent
e7b33e9ae7
commit
c92e48ce3f
@ -132,7 +132,8 @@ type Ethereum struct {
|
|||||||
|
|
||||||
logger ethlogger.LogSystem
|
logger ethlogger.LogSystem
|
||||||
|
|
||||||
Mining bool
|
Mining bool
|
||||||
|
version string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(config *Config) (*Ethereum, error) {
|
func New(config *Config) (*Ethereum, error) {
|
||||||
@ -175,6 +176,7 @@ func New(config *Config) (*Ethereum, error) {
|
|||||||
blacklist: p2p.NewBlacklist(),
|
blacklist: p2p.NewBlacklist(),
|
||||||
eventMux: &event.TypeMux{},
|
eventMux: &event.TypeMux{},
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
version: config.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
eth.chainManager = core.NewChainManager(db, eth.EventMux())
|
eth.chainManager = core.NewChainManager(db, eth.EventMux())
|
||||||
@ -231,6 +233,7 @@ func (s *Ethereum) PeerCount() int { return s.net.PeerCoun
|
|||||||
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) Coinbase() []byte { return nil } // TODO
|
func (s *Ethereum) Coinbase() []byte { return nil } // TODO
|
||||||
|
func (s *Ethereum) ClientVersion() string { return s.version }
|
||||||
|
|
||||||
// Start the ethereum
|
// Start the ethereum
|
||||||
func (s *Ethereum) Start() error {
|
func (s *Ethereum) Start() error {
|
||||||
|
@ -668,6 +668,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return p.WhisperMessages(args, reply)
|
return p.WhisperMessages(args, reply)
|
||||||
|
case "client_version":
|
||||||
|
*reply = p.eth.GetClientVersion()
|
||||||
default:
|
default:
|
||||||
return NewErrorWithMessage(errNotImplemented, req.Method)
|
return NewErrorWithMessage(errNotImplemented, req.Method)
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ type Backend interface {
|
|||||||
EventMux() *event.TypeMux
|
EventMux() *event.TypeMux
|
||||||
Whisper() *whisper.Whisper
|
Whisper() *whisper.Whisper
|
||||||
Miner() *miner.Miner
|
Miner() *miner.Miner
|
||||||
|
ClientVersion() string
|
||||||
}
|
}
|
||||||
|
|
||||||
type XEth struct {
|
type XEth struct {
|
||||||
@ -164,6 +165,10 @@ func (self *XEth) IsContract(address string) bool {
|
|||||||
return len(self.State().SafeGet(address).Code()) > 0
|
return len(self.State().SafeGet(address).Code()) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *XEth) GetClientVersion() string {
|
||||||
|
return self.eth.ClientVersion()
|
||||||
|
}
|
||||||
|
|
||||||
func (self *XEth) SecretToAddress(key string) string {
|
func (self *XEth) SecretToAddress(key string) string {
|
||||||
pair, err := crypto.NewKeyPairFromSec(fromHex(key))
|
pair, err := crypto.NewKeyPairFromSec(fromHex(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user