Skip to content

Commit

Permalink
fix slashing (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 authored Nov 28, 2024
1 parent 40a6449 commit ad71e28
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions internal/v2/types/delegation_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
StatePending DelegationState = "PENDING"
StateVerified DelegationState = "VERIFIED"
StateActive DelegationState = "ACTIVE"
StateSlashed DelegationState = "SLASHED"

// Unbonding states
StateTimelockUnbonding DelegationState = "TIMELOCK_UNBONDING"
Expand Down Expand Up @@ -45,6 +46,8 @@ func MapDelegationState(state indexertypes.DelegationState, subState indexertype
return StateVerified, nil
case indexertypes.StateActive:
return StateActive, nil
case indexertypes.StateSlashed:
return StateSlashed, nil

case indexertypes.StateUnbonding:
switch subState {
Expand Down Expand Up @@ -77,14 +80,6 @@ func MapDelegationState(state indexertypes.DelegationState, subState indexertype
case indexertypes.SubStateEarlyUnbondingSlashing:
return StateEarlyUnbondingSlashingWithdrawn, nil
}

case indexertypes.StateSlashed:
switch subState {
case indexertypes.SubStateTimelock:
return StateTimelockSlashed, nil
case indexertypes.SubStateEarlyUnbonding:
return StateEarlyUnbondingSlashed, nil
}
}

return "", fmt.Errorf("invalid state/subState combination: state=%s, subState=%s", state, subState)
Expand Down

0 comments on commit ad71e28

Please sign in to comment.