Skip to content

Commit

Permalink
add check
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Nov 26, 2024
1 parent e56d33c commit 90de0b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/db/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ func (db *Database) UpdateBTCDelegationState(
newState types.DelegationState,
newSubState *types.DelegationSubState,
) error {
if len(qualifiedPreviousStates) == 0 {
return fmt.Errorf("qualified previous states array cannot be empty")
}

qualifiedStateStrs := make([]string, len(qualifiedPreviousStates))
for i, state := range qualifiedPreviousStates {
qualifiedStateStrs[i] = state.String()
Expand Down

0 comments on commit 90de0b9

Please sign in to comment.