rpc: move getrawmempool RPC to a separate func

This commit is contained in:
Evgenii Stratonikov 2020-03-13 10:03:01 +03:00
parent 4e25c9121b
commit dfb4171e3c

View file

@ -258,12 +258,7 @@ Methods:
results = peers
case "getrawmempool":
mp := s.chain.GetMemPool()
hashList := make([]util.Uint256, 0)
for _, item := range mp.GetVerifiedTransactions() {
hashList = append(hashList, item.Tx.Hash())
}
results = hashList
results, resultsErr = s.getRawMempool(reqParams)
case "getstorage":
results, resultsErr = s.getStorage(reqParams)
@ -322,6 +317,15 @@ Methods:
s.WriteResponse(req, w, results)
}
func (s *Server) getRawMempool(_ request.Params) (interface{}, error) {
mp := s.chain.GetMemPool()
hashList := make([]util.Uint256, 0)
for _, item := range mp.GetVerifiedTransactions() {
hashList = append(hashList, item.Tx.Hash())
}
return hashList, nil
}
func (s *Server) validateAddress(reqParams request.Params) (interface{}, error) {
param, ok := reqParams.Value(0)
if !ok {