Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Jan 3, 2025
1 parent d4c7e0e commit cd43bc9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/db/timelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (db *Database) FindExpiredDelegations(ctx context.Context, btcTipHeight, li

func (db *Database) DeleteExpiredDelegation(ctx context.Context, stakingTxHashHex string) error {
client := db.client.Database(db.dbName).Collection(model.TimeLockCollection)
filter := bson.M{"_id": stakingTxHashHex}
filter := bson.M{"staking_tx_hash_hex": stakingTxHashHex}

result, err := client.DeleteOne(ctx, filter)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/services/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ func (s *Service) validateBTCDelegationExpiredEvent(ctx context.Context, event *
Str("stakingTxHashHex", event.StakingTxHash).
Str("currentState", delegation.State.String()).
Str("event_type", "EventBTCDelegationExpired").
Msg("Current state is not qualified for transition")
Msg("current state is not qualified for transition")
return false, false, types.NewErrorWithMsg(
http.StatusForbidden,
types.Forbidden,
"Current state is not qualified for transition",
"current state is not qualified for transition",
)
}

Expand Down
6 changes: 3 additions & 3 deletions internal/services/expiry_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func (s *Service) checkExpiry(ctx context.Context) *types.Error {
Str("current_state", delegation.State.String()).
Str("new_sub_state", tlDoc.DelegationSubState.String()).
Str("expire_height", strconv.FormatUint(uint64(tlDoc.ExpireHeight), 10)).
Msg("checking if delegation is expired")
Msg("checking if delegation is withdrawable")

if utils.Contains(types.OutdatedStatesForExpired(), delegation.State) {
if utils.Contains(types.OutdatedStatesForWithdrawable(), delegation.State) {
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("current_state", delegation.State.String()).
Msg("current state is outdated for expired")
Msg("current state is outdated for withdrawable")

if err := s.emitWithdrawableDelegationEvent(ctx, delegation); err != nil {
log.Error().
Expand Down

0 comments on commit cd43bc9

Please sign in to comment.