forked from TrueCloudLab/neoneo-go
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":
|
case "getpeers":
|
||||||
peers := result.NewGetPeers()
|
results, resultsErr = s.getPeers(reqParams)
|
||||||
peers.AddUnconnected(s.coreServer.UnconnectedPeers())
|
|
||||||
peers.AddConnected(s.coreServer.ConnectedPeers())
|
|
||||||
peers.AddBad(s.coreServer.BadPeers())
|
|
||||||
results = peers
|
|
||||||
|
|
||||||
case "getrawmempool":
|
case "getrawmempool":
|
||||||
results, resultsErr = s.getRawMempool(reqParams)
|
results, resultsErr = s.getRawMempool(reqParams)
|
||||||
|
@ -317,6 +313,14 @@ Methods:
|
||||||
s.WriteResponse(req, w, results)
|
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) {
|
func (s *Server) getRawMempool(_ request.Params) (interface{}, error) {
|
||||||
mp := s.chain.GetMemPool()
|
mp := s.chain.GetMemPool()
|
||||||
hashList := make([]util.Uint256, 0)
|
hashList := make([]util.Uint256, 0)
|
||||||
|
|
Loading…
Reference in a new issue