simplify rcp call methods

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-03 15:25:22 -04:00 committed by Jakub
parent 70083a03c9
commit 9d236b298a
2 changed files with 13 additions and 29 deletions

View File

@ -16,38 +16,22 @@ func newClient(url string) (*StatusGoClient, error) {
return &StatusGoClient{rpcClient}, nil
}
func (c *StatusGoClient) nodeInfo() (*NodeInfo, error) {
var info NodeInfo
err := c.rpcClient.Call(&info, "admin_nodeInfo")
if err != nil {
return nil, err
}
return &info, nil
func (c *StatusGoClient) nodeInfo() (info NodeInfo, err error) {
err = c.rpcClient.Call(&info, "admin_nodeInfo")
return
}
func (c *StatusGoClient) getPeers() ([]Peer, error) {
var peers []Peer
err := c.rpcClient.Call(&peers, "admin_peers")
if err != nil {
return nil, err
}
return peers, nil
func (c *StatusGoClient) getPeers() (peers []Peer, err error) {
err = c.rpcClient.Call(&peers, "admin_peers")
return
}
func (c *StatusGoClient) removePeer(enode string) (bool, error) {
var rval bool
err := c.rpcClient.Call(&rval, "admin_removePeer", enode)
if err != nil {
return false, err
}
return rval, nil
func (c *StatusGoClient) removePeer(enode string) (success bool, err error) {
err = c.rpcClient.Call(&success, "admin_removePeer", enode)
return
}
func (c *StatusGoClient) trustPeer(enode string) (bool, error) {
var rval bool
err := c.rpcClient.Call(&rval, "shh_markTrustedPeer", enode)
if err != nil {
return false, err
}
return rval, nil
func (c *StatusGoClient) trustPeer(enode string) (success bool, err error) {
err = c.rpcClient.Call(&success, "shh_markTrustedPeer", enode)
return
}

View File

@ -46,6 +46,6 @@ func (s *StateController) GetInfo() error {
if err != nil {
return err
}
s.State.UpdateInfo(*info)
s.State.UpdateInfo(info)
return nil
}