[#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 <leonard@nspcc.ru>
This commit is contained in:
parent
e5e5395830
commit
8efeba8010
1 changed files with 11 additions and 5 deletions
|
@ -142,17 +142,21 @@ func (s *subscriber) routeNotifications(ctx context.Context) {
|
||||||
|
|
||||||
switch notification.Type {
|
switch notification.Type {
|
||||||
case response.NotificationEventID:
|
case response.NotificationEventID:
|
||||||
notification, ok := notification.Value.(*state.NotificationEvent)
|
notifyEvent, ok := notification.Value.(*subscriptions.NotificationEvent)
|
||||||
if !ok {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
s.notifyChan <- notification
|
s.notifyChan <- ¬ifyEvent.NotificationEvent
|
||||||
case response.BlockEventID:
|
case response.BlockEventID:
|
||||||
b, ok := notification.Value.(*block.Block)
|
b, ok := notification.Value.(*block.Block)
|
||||||
if !ok {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +164,9 @@ func (s *subscriber) routeNotifications(ctx context.Context) {
|
||||||
case response.NotaryRequestEventID:
|
case response.NotaryRequestEventID:
|
||||||
notaryRequest, ok := notification.Value.(*subscriptions.NotaryRequestEvent)
|
notaryRequest, ok := notification.Value.(*subscriptions.NotaryRequestEvent)
|
||||||
if !ok {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue