From c68ae5f097cd06a97db3ba58b4d61ffe84c1c6d1 Mon Sep 17 00:00:00 2001 From: Gurjot Date: Tue, 29 Oct 2024 16:48:10 +0400 Subject: [PATCH] fix --- internal/services/delegation.go | 9 ++++----- internal/types/timelock_tx_type.go | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/services/delegation.go b/internal/services/delegation.go index cbecc36..f840ef3 100644 --- a/internal/services/delegation.go +++ b/internal/services/delegation.go @@ -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, @@ -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, @@ -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, diff --git a/internal/types/timelock_tx_type.go b/internal/types/timelock_tx_type.go index ca5af2e..4b78509 100644 --- a/internal/types/timelock_tx_type.go +++ b/internal/types/timelock_tx_type.go @@ -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 {