From a9e5ae2221384cbc583105d7b896f1ecbbc349d0 Mon Sep 17 00:00:00 2001 From: luke miles Date: Mon, 26 Sep 2022 03:04:48 -0700 Subject: [PATCH] api: update root endpoint to have correct query func (#80) --- api/root.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/root.go b/api/root.go index f6228aa..295fe03 100644 --- a/api/root.go +++ b/api/root.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/jackc/pgx/v4" ) func proofURLToDBQuery(param string) string { @@ -53,6 +54,11 @@ func (s *Server) GetRoot(w http.ResponseWriter, r *http.Request) { roots := make([]hexutil.Bytes, 0) rb := make(hexutil.Bytes, 0) + _, err := s.db.QueryFunc(ctx, q, []interface{}{dbQuery}, []interface{}{&rb}, func(qfr pgx.QueryFuncRow) error { + roots = append(roots, rb) + return nil + }) + if err != nil { s.sendJSONError(r, w, err, http.StatusInternalServerError, "selecting root") return