From 8efeba8010d331dfaab3c03e8d0f0fb4ce1d8793 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 14 Oct 2021 12:39:21 +0300 Subject: [PATCH] [#833] morph/subscriber: Change value cast for NotificationEventID `WSClient` of Neo Go v0.97.3 sets value of notification with `NotificationEventID` to `subscriptions.NotificationEvent` type which wraps previously used `state.NotificationEvent`. Change type cast and pull `state.NotificationEvent` structure from new type. Signed-off-by: Leonard Lyubich --- pkg/morph/subscriber/subscriber.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/morph/subscriber/subscriber.go b/pkg/morph/subscriber/subscriber.go index e475c74f..d8c94b8d 100644 --- a/pkg/morph/subscriber/subscriber.go +++ b/pkg/morph/subscriber/subscriber.go @@ -142,17 +142,21 @@ func (s *subscriber) routeNotifications(ctx context.Context) { switch notification.Type { case response.NotificationEventID: - notification, ok := notification.Value.(*state.NotificationEvent) + notifyEvent, ok := notification.Value.(*subscriptions.NotificationEvent) if !ok { - s.log.Error("can't cast notify event value to the notify struct") + s.log.Error("can't cast notify event value to the notify struct", + zap.String("received type", fmt.Sprintf("%T", notification.Value)), + ) continue } - s.notifyChan <- notification + s.notifyChan <- ¬ifyEvent.NotificationEvent case response.BlockEventID: b, ok := notification.Value.(*block.Block) if !ok { - s.log.Error("can't cast block event value to block") + s.log.Error("can't cast block event value to block", + zap.String("received type", fmt.Sprintf("%T", notification.Value)), + ) continue } @@ -160,7 +164,9 @@ func (s *subscriber) routeNotifications(ctx context.Context) { case response.NotaryRequestEventID: notaryRequest, ok := notification.Value.(*subscriptions.NotaryRequestEvent) if !ok { - s.log.Error("can't cast notify event value to the notary request struct") + s.log.Error("can't cast notify event value to the notary request struct", + zap.String("received type", fmt.Sprintf("%T", notification.Value)), + ) continue }