mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-17 15:09:59 +00:00
Bitfinex: Improve websocket type assertion checks for order processing (#1292)
* Bitfinex: Error if ws data id/cid is not a float64 * Bitfinex: Add annotation to WS id/cid assest errs
This commit is contained in:
@@ -916,7 +916,9 @@ func (b *Bitfinex) handleWSNotification(d []interface{}, respRaw []byte) error {
|
||||
}
|
||||
case strings.Contains(channelName, wsOrderNewRequest):
|
||||
if data[2] != nil {
|
||||
if cid, ok := data[2].(float64); ok && cid > 0 {
|
||||
if cid, ok := data[2].(float64); !ok {
|
||||
return common.GetTypeAssertError("float64", data[2], channelName+" cid")
|
||||
} else if cid > 0 {
|
||||
if b.Websocket.Match.IncomingWithData(int64(cid), respRaw) {
|
||||
return nil
|
||||
}
|
||||
@@ -926,7 +928,9 @@ func (b *Bitfinex) handleWSNotification(d []interface{}, respRaw []byte) error {
|
||||
case strings.Contains(channelName, wsOrderUpdateRequest),
|
||||
strings.Contains(channelName, wsOrderCancelRequest):
|
||||
if data[0] != nil {
|
||||
if id, ok := data[0].(float64); ok && id > 0 {
|
||||
if id, ok := data[0].(float64); !ok {
|
||||
return common.GetTypeAssertError("float64", data[0], channelName+" id")
|
||||
} else if id > 0 {
|
||||
if b.Websocket.Match.IncomingWithData(int64(id), respRaw) {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user