core, rpc: add GetCommittee method

Closes #1414
This commit is contained in:
Anna Shaleva 2020-09-21 15:34:04 +03:00
parent dbfdfd8e9b
commit 770c8d774c
7 changed files with 74 additions and 0 deletions

View file

@ -87,6 +87,7 @@ var rpcHandlers = map[string]func(*Server, request.Params) (interface{}, *respon
"getblockhash": (*Server).getBlockHash,
"getblockheader": (*Server).getBlockHeader,
"getblocksysfee": (*Server).getBlockSysFee,
"getcommittee": (*Server).getCommittee,
"getconnectioncount": (*Server).getConnectionCount,
"getcontractstate": (*Server).getContractState,
"getnep5balances": (*Server).getNEP5Balances,
@ -881,6 +882,15 @@ func (s *Server) getValidators(_ request.Params) (interface{}, *response.Error)
return res, nil
}
// getCommittee returns the current list of NEO committee members
func (s *Server) getCommittee(_ request.Params) (interface{}, *response.Error) {
keys, err := s.chain.GetCommittee()
if err != nil {
return nil, response.NewInternalServerError("can't get committee members", err)
}
return keys, nil
}
// invokeFunction implements the `invokeFunction` RPC call.
func (s *Server) invokeFunction(reqParams request.Params) (interface{}, *response.Error) {
scriptHash, err := reqParams.ValueWithType(0, request.StringT).GetUint160FromHex()