feat(daemon): add getblockcount RPC, fix method routing
All checks were successful
Security Scan / security (push) Successful in 23s

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 00:17:36 +01:00
parent b3b77a618a
commit 9f20e7a2e8
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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",
})
}