From 9aecfb7c94d4ec594b6d3ee6e41aec8c41fa08a8 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 7 Jul 2022 17:45:33 +0300 Subject: [PATCH] rpc/client: correct ID unmarshaling in wsclient We always use uint64 IDs in the client, so we should parse them as such and not just ints that then are casted to uint64. --- pkg/rpc/client/wsclient.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rpc/client/wsclient.go b/pkg/rpc/client/wsclient.go index 4a36585f8..5d3d00439 100644 --- a/pkg/rpc/client/wsclient.go +++ b/pkg/rpc/client/wsclient.go @@ -205,12 +205,12 @@ readloop: } c.Notifications <- Notification{event, val} } else if rr.ID != nil && (rr.Error != nil || rr.Result != nil) { - id, err := strconv.Atoi(string(rr.ID)) + id, err := strconv.ParseUint(string(rr.ID), 10, 64) if err != nil { connCloseErr = fmt.Errorf("failed to retrieve response ID from string %s: %w", string(rr.ID), err) break readloop // Malformed response (invalid response ID). } - ch := c.getResponseChannel(uint64(id)) + ch := c.getResponseChannel(id) if ch == nil { connCloseErr = fmt.Errorf("unknown response channel for response %d", id) break readloop // Unknown response (unexpected response ID).