diff --git a/core/services/gateway/handlers/functions/subscriptions/user_subscriptions.go b/core/services/gateway/handlers/functions/subscriptions/user_subscriptions.go index ec506b6a864..8d30f7de9cf 100644 --- a/core/services/gateway/handlers/functions/subscriptions/user_subscriptions.go +++ b/core/services/gateway/handlers/functions/subscriptions/user_subscriptions.go @@ -2,6 +2,7 @@ package subscriptions import ( "math/big" + "reflect" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" @@ -54,7 +55,7 @@ func (us *userSubscriptions) UpdateSubscription(subscriptionId uint64, subscript } // there is no change to the subscription - if us.userSubscriptionsMap[subscription.Owner][subscriptionId] == subscription { + if reflect.DeepEqual(us.userSubscriptionsMap[subscription.Owner][subscriptionId], subscription) { return false } diff --git a/core/services/gateway/handlers/functions/subscriptions/user_subscriptions_test.go b/core/services/gateway/handlers/functions/subscriptions/user_subscriptions_test.go index 4d58155735f..63750058bab 100644 --- a/core/services/gateway/handlers/functions/subscriptions/user_subscriptions_test.go +++ b/core/services/gateway/handlers/functions/subscriptions/user_subscriptions_test.go @@ -135,15 +135,16 @@ func TestUserSubscriptions_UpdateSubscription(t *testing.T) { t.Run("no actual changes", func(t *testing.T) { us := subscriptions.NewUserSubscriptions() - subscription := &functions_router.IFunctionsSubscriptionsSubscription{ + subscription := functions_router.IFunctionsSubscriptionsSubscription{ Owner: utils.RandomAddress(), Balance: big.NewInt(25), BlockedBalance: big.NewInt(25), } - updated := us.UpdateSubscription(5, subscription) + identicalSubscription := functions_router.IFunctionsSubscriptionsSubscription(subscription) + updated := us.UpdateSubscription(5, &subscription) assert.True(t, updated) - updated = us.UpdateSubscription(5, subscription) + updated = us.UpdateSubscription(5, &identicalSubscription) assert.False(t, updated) }) }