Skip to content

Commit ba27ef2

Browse files
authored
fix(api): Added return statement in hashTxHandler whenever we receive an error after logging (#381)
Signed-off-by: Akhil Repala <[email protected]>
1 parent e608b9e commit ba27ef2

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

internal/api/api.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,8 @@ func handleHasTx(c *gin.Context) {
231231
}
232232

233233
// Connect to cardano-node and check for transaction
234-
errorChan := make(chan error)
235234
oConn, err := ouroboros.NewConnection(
236235
ouroboros.WithNetworkMagic(uint32(cfg.Node.NetworkMagic)),
237-
ouroboros.WithErrorChan(errorChan),
238236
ouroboros.WithNodeToNode(false),
239237
)
240238
if err != nil {
@@ -255,14 +253,6 @@ func handleHasTx(c *gin.Context) {
255253
return
256254
}
257255
}
258-
// Start async error handler
259-
go func() {
260-
err, ok := <-errorChan
261-
if ok {
262-
logger.Errorf("failure communicating with node: %s", err)
263-
c.JSON(500, "failure communicating with node")
264-
}
265-
}()
266256
defer func() {
267257
// Close Ouroboros connection
268258
oConn.Close()
@@ -271,6 +261,7 @@ func handleHasTx(c *gin.Context) {
271261
if err != nil {
272262
logger.Errorf("failure getting transaction: %s", err)
273263
c.JSON(500, fmt.Sprintf("failure getting transaction: %s", err))
264+
return
274265
}
275266
if !hasTx {
276267
c.JSON(404, "transaction not found in mempool")

0 commit comments

Comments
 (0)