Skip to content

Commit

Permalink
change to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Nov 26, 2024
1 parent 90de0b9 commit eac1260
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/services/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *Service) processBTCDelegationUnbondedEarlyEvent(
)
}

log.Info().
log.Debug().
Str("staking_tx", unbondedEarlyEvent.StakingTxHash).
Str("new_state", types.StateUnbonding.String()).
Str("early_unbonding_start_height", unbondedEarlyEvent.StartHeight).
Expand Down
4 changes: 2 additions & 2 deletions internal/services/delegation_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (s *Service) registerUnbondingSpendNotification(
)
}

log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("unbonding_tx", unbondingTx.TxHash().String()).
Msg("registering early unbonding spend notification")
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *Service) registerStakingSpendNotification(
)
}

log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Msg("registering staking spend notification")

Expand Down
2 changes: 1 addition & 1 deletion internal/services/expiry_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (s *Service) checkExpiry(ctx context.Context) *types.Error {
)
}

log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("current_state", delegation.State.String()).
Msg("checking if delegation is expired")
Expand Down
16 changes: 8 additions & 8 deletions internal/services/watch_btc_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *Service) watchForSpendStakingTx(
// Get spending details
select {
case spendDetail := <-spendEvent.Spend:
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("spending_tx", spendDetail.SpendingTx.TxHash().String()).
Msg("staking tx has been spent")
Expand Down Expand Up @@ -68,7 +68,7 @@ func (s *Service) watchForSpendUnbondingTx(
// Get spending details
select {
case spendDetail := <-spendEvent.Spend:
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("unbonding_tx", spendDetail.SpendingTx.TxHash().String()).
Msg("unbonding tx has been spent")
Expand Down Expand Up @@ -105,7 +105,7 @@ func (s *Service) watchForSpendSlashingChange(

select {
case spendDetail := <-spendEvent.Spend:
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("spending_tx", spendDetail.SpendingTx.TxHash().String()).
Msg("slashing change output has been spent")
Expand Down Expand Up @@ -170,7 +170,7 @@ func (s *Service) handleSpendingStakingTransaction(
return fmt.Errorf("failed to validate unbonding tx: %w", err)
}
if isUnbonding {
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("unbonding_tx", spendingTx.TxHash().String()).
Msg("staking tx has been spent through unbonding path")
Expand All @@ -182,7 +182,7 @@ func (s *Service) handleSpendingStakingTransaction(
withdrawalErr := s.validateWithdrawalTxFromStaking(spendingTx, spendingInputIdx, delegation, params)
if withdrawalErr == nil {
// It's a valid withdrawal, process it
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("withdrawal_tx", spendingTx.TxHash().String()).
Msg("staking tx has been spent through withdrawal path")
Expand Down Expand Up @@ -229,7 +229,7 @@ func (s *Service) handleSpendingUnbondingTransaction(
withdrawalErr := s.validateWithdrawalTxFromUnbonding(spendingTx, delegation, spendingInputIdx, params)
if withdrawalErr == nil {
// It's a valid withdrawal, process it
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("unbonding_tx", spendingTx.TxHash().String()).
Msg("unbonding tx has been spent through withdrawal path")
Expand Down Expand Up @@ -280,7 +280,7 @@ func (s *Service) handleWithdrawal(
}

// Update to withdrawn state
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("state", types.StateWithdrawn.String()).
Str("sub_state", subState.String()).
Expand All @@ -301,7 +301,7 @@ func (s *Service) startWatchingSlashingChange(
delegation *model.BTCDelegationDetails,
subState types.DelegationSubState,
) error {
log.Info().
log.Debug().
Str("staking_tx", delegation.StakingTxHashHex).
Str("slashing_tx", slashingTx.TxHash().String()).
Msg("watching for slashing change output")
Expand Down
6 changes: 4 additions & 2 deletions internal/types/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ func QualifiedStatesForWithdrawable() []DelegationState {
type DelegationSubState string

const (
SubStateTimelock DelegationSubState = "TIMELOCK"
SubStateEarlyUnbonding DelegationSubState = "EARLY_UNBONDING"
SubStateTimelock DelegationSubState = "TIMELOCK"
SubStateEarlyUnbonding DelegationSubState = "EARLY_UNBONDING"

// Used only for Withdrawable and Withdrawn parent states
SubStateTimelockSlashing DelegationSubState = "TIMELOCK_SLASHING"
SubStateEarlyUnbondingSlashing DelegationSubState = "EARLY_UNBONDING_SLASHING"
)
Expand Down

0 comments on commit eac1260

Please sign in to comment.