rpc: move validateaddress RPC to a separate func
This commit is contained in:
parent
70eb0b175a
commit
4e25c9121b
1 changed files with 9 additions and 6 deletions
|
@ -269,12 +269,7 @@ Methods:
|
|||
results, resultsErr = s.getStorage(reqParams)
|
||||
|
||||
case "validateaddress":
|
||||
param, ok := reqParams.Value(0)
|
||||
if !ok {
|
||||
resultsErr = response.ErrInvalidParams
|
||||
break Methods
|
||||
}
|
||||
results = validateAddress(param.Value)
|
||||
results, resultsErr = s.validateAddress(reqParams)
|
||||
|
||||
case "getassetstate":
|
||||
results, resultsErr = s.getAssetState(reqParams)
|
||||
|
@ -327,6 +322,14 @@ Methods:
|
|||
s.WriteResponse(req, w, results)
|
||||
}
|
||||
|
||||
func (s *Server) validateAddress(reqParams request.Params) (interface{}, error) {
|
||||
param, ok := reqParams.Value(0)
|
||||
if !ok {
|
||||
return nil, response.ErrInvalidParams
|
||||
}
|
||||
return validateAddress(param.Value), nil
|
||||
}
|
||||
|
||||
func (s *Server) getAssetState(reqParams request.Params) (interface{}, error) {
|
||||
param, ok := reqParams.ValueWithType(0, request.StringT)
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in a new issue