diff --git a/internal/v2/db/client/stats.go b/internal/v2/db/client/stats.go index 10f28e5..d997b08 100644 --- a/internal/v2/db/client/stats.go +++ b/internal/v2/db/client/stats.go @@ -70,7 +70,7 @@ func (v2dbclient *V2Database) IncrementOverallStats( } // Define the work to be done in the transaction transactionWork := func(sessCtx mongo.SessionContext) (interface{}, error) { - err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, types.Active.ToString(), "v2_overall_stats") + err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, types.Active.ToString(), "overall_stats") if err != nil { return nil, err } @@ -132,7 +132,7 @@ func (v2dbclient *V2Database) SubtractOverallStats( // Define the work to be done in the transaction transactionWork := func(sessCtx mongo.SessionContext) (interface{}, error) { - err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, types.Unbonded.ToString(), "v2_overall_stats") + err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, types.Unbonded.ToString(), "overall_stats") if err != nil { return nil, err } @@ -269,7 +269,7 @@ func (v2dbclient *V2Database) updateStakerStats(ctx context.Context, state, stak defer session.EndSession(ctx) transactionWork := func(sessCtx mongo.SessionContext) (interface{}, error) { - err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, state, "v2_staker_stats") + err := v2dbclient.updateStatsLockByFieldName(sessCtx, stakingTxHashHex, state, "staker_stats") if err != nil { return nil, err } diff --git a/internal/v2/queue/handler/staking.go b/internal/v2/queue/handler/staking.go index 5b44972..5db9481 100644 --- a/internal/v2/queue/handler/staking.go +++ b/internal/v2/queue/handler/staking.go @@ -20,23 +20,11 @@ func (h *V2QueueHandler) ActiveStakingHandler(ctx context.Context, messageBody s return types.NewError(http.StatusBadRequest, types.BadRequest, err) } - // Check if delegation already exists - exist, delError := h.Service.IsDelegationPresent(ctx, activeStakingEvent.StakingTxHashHex) - if delError != nil { - return delError + // Perform the address lookup conversion + addressLookupErr := h.performAddressLookupConversion(ctx, activeStakingEvent.StakerBtcPkHex, types.Active) + if addressLookupErr != nil { + return addressLookupErr } - if exist { - // Ignore the message as the delegation already exists. This is a duplicate message - log.Ctx(ctx).Debug().Str("StakingTxHashHex", activeStakingEvent.StakingTxHashHex). - Msg("delegation already exists") - return nil - } - - // // Perform the address lookup conversion - // addressLookupErr := h.performAddressLookupConversion(ctx, activeStakingEvent.StakerBtcPkHex, types.Active) - // if addressLookupErr != nil { - // return addressLookupErr - // } // Perform the stats calculation statsErr := h.Service.ProcessStakingStatsCalculation(