From 969ed6e6e1f75e832c9e07152f15917ec48c0f6a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 13 Mar 2020 10:14:06 +0300 Subject: [PATCH] rpc: move getaccountstate/getunspents RPCs to a separate func --- pkg/rpc/server/server.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 9b08c3dc5..70ef1fa62 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -210,7 +210,7 @@ func (s *Server) methodHandler(w http.ResponseWriter, req *request.In, reqParams results, resultsErr = s.getAssetState(reqParams) case "getaccountstate": - results, resultsErr = s.getAccountState(reqParams, false) + results, resultsErr = s.getAccountState(reqParams) case "getcontractstate": results, resultsErr = s.getContractState(reqParams) @@ -228,7 +228,7 @@ func (s *Server) methodHandler(w http.ResponseWriter, req *request.In, reqParams results, resultsErr = s.getUnclaimed(reqParams) case "getunspents": - results, resultsErr = s.getAccountState(reqParams, true) + results, resultsErr = s.getUnspents(reqParams) case "invoke": results, resultsErr = s.invoke(reqParams) @@ -720,8 +720,16 @@ func (s *Server) getContractState(reqParams request.Params) (interface{}, error) return results, nil } +func (s *Server) getAccountState(ps request.Params) (interface{}, error) { + return s.getAccountStateAux(ps, false) +} + +func (s *Server) getUnspents(ps request.Params) (interface{}, error) { + return s.getAccountStateAux(ps, true) +} + // getAccountState returns account state either in short or full (unspents included) form. -func (s *Server) getAccountState(reqParams request.Params, unspents bool) (interface{}, error) { +func (s *Server) getAccountStateAux(reqParams request.Params, unspents bool) (interface{}, error) { var resultsErr error var results interface{}