MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / waitTx

Function waitTx

cmd/cql-proxy/api/database.go:166–196  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

164}
165
166func waitTx(c *gin.Context) {
167 r := struct {
168 Tx string `json:"tx" form:"tx" uri:"tx" binding:"required,len=64"`
169 }{}
170
171 _ = c.ShouldBindUri(&r)
172
173 if err := c.ShouldBind(&r); err != nil {
174 abortWithError(c, http.StatusBadRequest, err)
175 return
176 }
177
178 var h hash.Hash
179
180 if err := hash.Decode(&h, r.Tx); err != nil {
181 _ = c.Error(err)
182 abortWithError(c, http.StatusBadRequest, ErrInvalidTxHash)
183 return
184 }
185
186 txState, err := client.WaitTxConfirmation(c.Request.Context(), h)
187 if err != nil {
188 _ = c.Error(err)
189 abortWithError(c, http.StatusInternalServerError, ErrWaitTxConfirmationTimeout)
190 return
191 }
192
193 responseWithData(c, http.StatusOK, gin.H{
194 "state": txState.String(),
195 })
196}
197
198func databaseList(c *gin.Context) {
199 // query account belongings

Callers

nothing calls this directly

Calls 6

DecodeFunction · 0.92
WaitTxConfirmationFunction · 0.92
abortWithErrorFunction · 0.85
responseWithDataFunction · 0.85
ErrorMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected