From e222f87031ba464b58b083cdb3796b66c20c93f3 Mon Sep 17 00:00:00 2001 From: Gurjot Date: Sun, 24 Nov 2024 16:18:15 +0530 Subject: [PATCH] fix --- internal/services/watch_btc_events.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/services/watch_btc_events.go b/internal/services/watch_btc_events.go index c5df1d6..85426d4 100644 --- a/internal/services/watch_btc_events.go +++ b/internal/services/watch_btc_events.go @@ -267,17 +267,18 @@ func (s *Service) startWatchingSlashingChange( return fmt.Errorf("failed to register spend ntfn for slashing change output: %w", err) } - // TODO: confirm if we this is correct or do we need max(w, minUnbondingTime) + // TODO: confirm if this is correct + // in btc-staker it is max(w, minUnbondingTime) stakingParams, err := s.db.GetStakingParams(ctx, delegation.ParamsVersion) if err != nil { return fmt.Errorf("failed to get staking params: %w", err) } - slashingExpireHeight := spendingHeight + stakingParams.MinUnbondingTimeBlocks - // Save timelock expire + slashingChangeTimelockExpireHeight := spendingHeight + stakingParams.MinUnbondingTimeBlocks + // Save timelock expire to mark it as Withdrawn (sub state - timelock_slashing/early_unbonding_slashing) if err := s.db.SaveNewTimeLockExpire( ctx, delegation.StakingTxHashHex, - slashingExpireHeight, + slashingChangeTimelockExpireHeight, subState, ); err != nil { return fmt.Errorf("failed to save timelock expire: %w", err)