Skip to content

Commit

Permalink
invert condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Oct 17, 2024
1 parent e8660f2 commit 724a2ab
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions eth/eventhandler/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,23 @@ func (eh *EventHandler) handleOperatorAdded(txn basedb.Txn, event *contract.Cont
continue
}

var missingOtherOperators bool
var existingOperatorsCount int
for _, shareMember := range share.Committee {
if shareMember.Signer == event.OperatorId {
continue
existingOperatorsCount++
}

_, ok, err := eh.nodeStorage.GetOperatorData(txn, shareMember.Signer)
if err != nil {
return fmt.Errorf("get operator data: %w", err)
}

if !ok {
missingOtherOperators = true
break
if ok {
existingOperatorsCount++
}
}

if !missingOtherOperators {
if existingOperatorsCount == len(share.Committee) {
share.Liquidated = false
modifiedShares = append(modifiedShares, share)
}
Expand Down

0 comments on commit 724a2ab

Please sign in to comment.