feat(daemon): add getblockcount RPC, fix method routing
All checks were successful
Security Scan / security (push) Successful in 23s
All checks were successful
Security Scan / security (push) Successful in 23s
Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
b3b77a618a
commit
9f20e7a2e8
1 changed files with 10 additions and 0 deletions
|
|
@ -90,6 +90,8 @@ func (s *Server) handleJSONRPC(w http.ResponseWriter, r *http.Request) {
|
|||
s.rpcGetAllAliasDetails(w, req)
|
||||
case "get_alias_details":
|
||||
s.rpcGetAliasDetails(w, req)
|
||||
case "getblockcount":
|
||||
s.rpcGetBlockCount(w, req)
|
||||
default:
|
||||
writeError(w, req.ID, -32601, core.Sprintf("method %s not found", req.Method))
|
||||
}
|
||||
|
|
@ -263,3 +265,11 @@ func (s *Server) rpcGetAliasCount(w http.ResponseWriter, req jsonRPCRequest) {
|
|||
"status": "OK",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) rpcGetBlockCount(w http.ResponseWriter, req jsonRPCRequest) {
|
||||
height, _ := s.chain.Height()
|
||||
writeResult(w, req.ID, map[string]interface{}{
|
||||
"count": height,
|
||||
"status": "OK",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue