Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion internal/jsonrpc/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,10 @@ func handleListTournaments(s *Service, w http.ResponseWriter, r *http.Request, r
writeRPCError(w, req.ID, JSONRPC_INTERNAL_ERROR, "Internal server error", nil)
return
}
if len(tournaments) == 0 && !s.applicationExists(w, r, req, params.Application) {
writeRPCError(w, req.ID, JSONRPC_RESOURCE_NOT_FOUND, "Application not found", nil)
return
}
if tournaments == nil {
tournaments = []*model.Tournament{}
}
Expand Down Expand Up @@ -1043,6 +1047,10 @@ func handleListCommitments(s *Service, w http.ResponseWriter, r *http.Request, r
writeRPCError(w, req.ID, JSONRPC_INTERNAL_ERROR, "Internal server error", nil)
return
}
if len(commitments) == 0 && !s.applicationExists(w, r, req, params.Application) {
writeRPCError(w, req.ID, JSONRPC_RESOURCE_NOT_FOUND, "Application not found", nil)
return
}
if commitments == nil {
commitments = []*model.Commitment{}
}
Expand Down Expand Up @@ -1173,6 +1181,10 @@ func handleListMatches(s *Service, w http.ResponseWriter, r *http.Request, req R
writeRPCError(w, req.ID, JSONRPC_INTERNAL_ERROR, "Internal server error", nil)
return
}
if len(matches) == 0 && !s.applicationExists(w, r, req, params.Application) {
writeRPCError(w, req.ID, JSONRPC_RESOURCE_NOT_FOUND, "Application not found", nil)
return
}
if matches == nil {
matches = []*model.Match{}
}
Expand Down Expand Up @@ -1303,6 +1315,10 @@ func handleListMatchAdvances(s *Service, w http.ResponseWriter, r *http.Request,
writeRPCError(w, req.ID, JSONRPC_INTERNAL_ERROR, "Internal server error", nil)
return
}
if len(matchAdvances) == 0 && !s.applicationExists(w, r, req, params.Application) {
writeRPCError(w, req.ID, JSONRPC_RESOURCE_NOT_FOUND, "Application not found", nil)
return
}
if matchAdvances == nil {
matchAdvances = []*model.MatchAdvanced{}
}
Expand Down Expand Up @@ -1367,7 +1383,7 @@ func handleGetMatchAdvanced(s *Service, w http.ResponseWriter, r *http.Request,
}

matchAdvanced, err := s.repository.GetMatchAdvanced(r.Context(), params.Application, epochIndex,
params.TournamentAddress, params.IDHash, params.Parent)
params.TournamentAddress, params.IDHash, params.Parent[2:]) // TODO: use parsed value
if err != nil {
s.Logger.Error("Unable to retrieve match advanced from repository", "err", err)
writeRPCError(w, req.ID, JSONRPC_INTERNAL_ERROR, "Internal server error", nil)
Expand Down
Loading
Loading