Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Oct 29, 2024
1 parent bd92780 commit c68ae5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions internal/services/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (s *Service) processBTCDelegationUnbondedEarlyEvent(
return consumerErr
}

startHeightInt, parseErr := strconv.ParseUint(unbondedEarlyEvent.StartHeight, 10, 32)
unbondingStartHeightInt, parseErr := strconv.ParseUint(unbondedEarlyEvent.StartHeight, 10, 32)
if parseErr != nil {
return types.NewError(
http.StatusInternalServerError,
Expand All @@ -256,7 +256,7 @@ func (s *Service) processBTCDelegationUnbondedEarlyEvent(
)
}

unbondingTimeInt, parseErr := strconv.ParseUint(delegation.UnbondingTime, 10, 32)
unbondingTimeLocalInt, parseErr := strconv.ParseUint(delegation.UnbondingTime, 10, 32)
if parseErr != nil {
return types.NewError(
http.StatusInternalServerError,
Expand All @@ -265,10 +265,9 @@ func (s *Service) processBTCDelegationUnbondedEarlyEvent(
)
}

expireHeight := startHeightInt + unbondingTimeInt

unbondingExpireHeight := unbondingStartHeightInt + unbondingTimeLocalInt
if dbErr := s.db.SaveNewTimeLockExpire(
ctx, delegation.StakingTxHashHex, uint32(expireHeight), types.ExpiredTxType.String(),
ctx, delegation.StakingTxHashHex, uint32(unbondingExpireHeight), types.EarlyUnbondingTxType.String(),
); dbErr != nil {
return types.NewError(
http.StatusInternalServerError,
Expand Down
3 changes: 2 additions & 1 deletion internal/types/timelock_tx_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package types
type TimeLockTxType string

const (
ExpiredTxType TimeLockTxType = "EXPIRED"
ExpiredTxType TimeLockTxType = "EXPIRED"
EarlyUnbondingTxType TimeLockTxType = "EARLY_UNBONDING"
)

func (t TimeLockTxType) String() string {
Expand Down

0 comments on commit c68ae5f

Please sign in to comment.