mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
rpc: move getpeers RPC to a separate func
This commit is contained in:
parent
dfb4171e3c
commit
99d02d5de0
1 changed files with 9 additions and 5 deletions
|
@ -251,11 +251,7 @@ Methods:
|
|||
}
|
||||
|
||||
case "getpeers":
|
||||
peers := result.NewGetPeers()
|
||||
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
||||
peers.AddConnected(s.coreServer.ConnectedPeers())
|
||||
peers.AddBad(s.coreServer.BadPeers())
|
||||
results = peers
|
||||
results, resultsErr = s.getPeers(reqParams)
|
||||
|
||||
case "getrawmempool":
|
||||
results, resultsErr = s.getRawMempool(reqParams)
|
||||
|
@ -317,6 +313,14 @@ Methods:
|
|||
s.WriteResponse(req, w, results)
|
||||
}
|
||||
|
||||
func (s *Server) getPeers(_ request.Params) (interface{}, error) {
|
||||
peers := result.NewGetPeers()
|
||||
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
||||
peers.AddConnected(s.coreServer.ConnectedPeers())
|
||||
peers.AddBad(s.coreServer.BadPeers())
|
||||
return peers, nil
|
||||
}
|
||||
|
||||
func (s *Server) getRawMempool(_ request.Params) (interface{}, error) {
|
||||
mp := s.chain.GetMemPool()
|
||||
hashList := make([]util.Uint256, 0)
|
||||
|
|
Loading…
Reference in a new issue