Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Jan 6, 2025
1 parent 7774cc5 commit 71a0d3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
1 change: 0 additions & 1 deletion internal/services/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ func (s *Service) processBTCDelegationExpiredEvent(
if err != nil {
return err
}

if !shouldProcess {
// Ignore the event silently
return nil
Expand Down
18 changes: 5 additions & 13 deletions internal/services/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,12 @@ func (s *Service) validateBTCDelegationUnbondedEarlyEvent(ctx context.Context, e

// Check if the current state is qualified for the transition
if !utils.Contains(types.QualifiedStatesForUnbondedEarly(), delegation.State) {
log.Error().
log.Debug().
Str("stakingTxHashHex", event.StakingTxHash).
Str("currentState", delegation.State.String()).
Str("event_type", "EventBTCDelgationUnbondedEarly").
Msg("Current state is not qualified for transition")
return false, types.NewErrorWithMsg(
http.StatusForbidden,
types.Forbidden,
"current state is not qualified for transition",
)
Msg("current state is not qualified for transition")
return false, nil
}

return true, nil
Expand Down Expand Up @@ -373,16 +369,12 @@ func (s *Service) validateBTCDelegationExpiredEvent(ctx context.Context, event *

// Check if the current state is qualified for the transition
if !utils.Contains(types.QualifiedStatesForExpired(), delegation.State) {
log.Error().
log.Debug().
Str("stakingTxHashHex", event.StakingTxHash).
Str("currentState", delegation.State.String()).
Str("event_type", "EventBTCDelegationExpired").
Msg("current state is not qualified for transition")
return false, types.NewErrorWithMsg(
http.StatusForbidden,
types.Forbidden,
"current state is not qualified for transition",
)
return false, nil
}

return true, nil
Expand Down
5 changes: 0 additions & 5 deletions internal/types/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ func QualifiedStatesForWithdrawable() []DelegationState {
return []DelegationState{StateUnbonding, StateSlashed}
}

// OutdatedStatesForWithdrawable returns the outdated current states for Withdrawable event
func OutdatedStatesForWithdrawable() []DelegationState {
return []DelegationState{StateWithdrawable, StateWithdrawn}
}

type DelegationSubState string

const (
Expand Down

0 comments on commit 71a0d3e

Please sign in to comment.