rpc: move getversion RPC to a separate func
This commit is contained in:
parent
99d02d5de0
commit
90fdde4018
1 changed files with 9 additions and 5 deletions
|
@ -244,11 +244,7 @@ Methods:
|
|||
results, resultsErr = s.getValidators()
|
||||
|
||||
case "getversion":
|
||||
results = result.Version{
|
||||
Port: s.coreServer.Port,
|
||||
Nonce: s.coreServer.ID(),
|
||||
UserAgent: s.coreServer.UserAgent,
|
||||
}
|
||||
results, resultsErr = s.getVersion(reqParams)
|
||||
|
||||
case "getpeers":
|
||||
results, resultsErr = s.getPeers(reqParams)
|
||||
|
@ -313,6 +309,14 @@ Methods:
|
|||
s.WriteResponse(req, w, results)
|
||||
}
|
||||
|
||||
func (s *Server) getVersion(_ request.Params) (interface{}, error) {
|
||||
return result.Version{
|
||||
Port: s.coreServer.Port,
|
||||
Nonce: s.coreServer.ID(),
|
||||
UserAgent: s.coreServer.UserAgent,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) getPeers(_ request.Params) (interface{}, error) {
|
||||
peers := result.NewGetPeers()
|
||||
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
||||
|
|
Loading…
Reference in a new issue