From 9afe86ba3e4e70bdf07a3225c93a195548d1cd9c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 27 Jan 2023 13:26:49 +0300 Subject: [PATCH] [#2212] morph: Fix subscription restoration Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/morph/client/notifications.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9002ee10..a5bd4e65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Changelog for FrostFS Node - Set flag `mode` required for `frostfs-cli control shards set-mode` (#8) - Fix `dirty` suffix in debian package version (#53) - Prevent node process from killing by systemd when shutting down (#1465) +- Restore subscriptions correctly on morph client switch (#2212) ### Removed ### Updated diff --git a/pkg/morph/client/notifications.go b/pkg/morph/client/notifications.go index 8eaf617b..63e5a5c8 100644 --- a/pkg/morph/client/notifications.go +++ b/pkg/morph/client/notifications.go @@ -226,6 +226,7 @@ func (c *Client) restoreSubscriptions(cli *rpcclient.WSClient, endpoint string) // notification events restoration for contract := range c.subscribedEvents { + contract := contract // See https://github.com/nspcc-dev/neo-go/issues/2890 id, err = cli.SubscribeForExecutionNotifications(&contract, nil) if err != nil { c.logger.Error("could not restore notification subscription after RPC switch", @@ -242,6 +243,7 @@ func (c *Client) restoreSubscriptions(cli *rpcclient.WSClient, endpoint string) // notary notification events restoration if c.notary != nil { for signer := range c.subscribedNotaryEvents { + signer := signer // See https://github.com/nspcc-dev/neo-go/issues/2890 id, err = cli.SubscribeForNotaryRequests(nil, &signer) if err != nil { c.logger.Error("could not restore notary notification subscription after RPC switch",