forked from TrueCloudLab/neoneo-go
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()
|
results, resultsErr = s.getValidators()
|
||||||
|
|
||||||
case "getversion":
|
case "getversion":
|
||||||
results = result.Version{
|
results, resultsErr = s.getVersion(reqParams)
|
||||||
Port: s.coreServer.Port,
|
|
||||||
Nonce: s.coreServer.ID(),
|
|
||||||
UserAgent: s.coreServer.UserAgent,
|
|
||||||
}
|
|
||||||
|
|
||||||
case "getpeers":
|
case "getpeers":
|
||||||
results, resultsErr = s.getPeers(reqParams)
|
results, resultsErr = s.getPeers(reqParams)
|
||||||
|
@ -313,6 +309,14 @@ Methods:
|
||||||
s.WriteResponse(req, w, results)
|
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) {
|
func (s *Server) getPeers(_ request.Params) (interface{}, error) {
|
||||||
peers := result.NewGetPeers()
|
peers := result.NewGetPeers()
|
||||||
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
||||||
|
|
Loading…
Reference in a new issue