From beb81406c90c404cf4ce966a6cf04ca6cb1e66ce Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Tue, 26 Sep 2023 11:11:44 +0700 Subject: [PATCH] Bitfinex: Simplify string uses of chanId --- exchanges/bitfinex/bitfinex_websocket.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exchanges/bitfinex/bitfinex_websocket.go b/exchanges/bitfinex/bitfinex_websocket.go index dc57d0b7d01..f33e6421d97 100644 --- a/exchanges/bitfinex/bitfinex_websocket.go +++ b/exchanges/bitfinex/bitfinex_websocket.go @@ -438,11 +438,11 @@ func (b *Bitfinex) handleWSEvent(respRaw []byte) error { return fmt.Errorf("%v channel subscribe listener not found", subID) } case wsEventUnsubscribed: - chanID, err := jsonparser.GetInt(respRaw, "chanId") + chanID, err := jsonparser.GetUnsafeString(respRaw, "chanId") if err != nil { return fmt.Errorf("error parsing WS unsubscribed event chanId: %w from message: %s", err, respRaw) } - if !b.Websocket.Match.IncomingWithData("unsubscribe:"+strconv.Itoa(int(chanID)), respRaw) { + if !b.Websocket.Match.IncomingWithData("unsubscribe:"+chanID, respRaw) { return fmt.Errorf("%v channel unsubscribe listener not found", chanID) } case wsEventError: @@ -450,8 +450,8 @@ func (b *Bitfinex) handleWSEvent(respRaw []byte) error { if !b.Websocket.Match.IncomingWithData("subscribe:"+subID, respRaw) { return fmt.Errorf("%v channel subscribe listener not found", subID) } - } else if chanID, err := jsonparser.GetInt(respRaw, "chanId"); err == nil { - if !b.Websocket.Match.IncomingWithData("unsubscribe:"+strconv.Itoa(int(chanID)), respRaw) { + } else if chanID, err := jsonparser.GetUnsafeString(respRaw, "chanId"); err == nil { + if !b.Websocket.Match.IncomingWithData("unsubscribe:"+chanID, respRaw) { return fmt.Errorf("%v channel unsubscribe listener not found", chanID) } } else {