Skip to content

Commit

Permalink
feat: apply PR reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
sm-stack committed Jul 25, 2024
1 parent 44752b8 commit 7310c11
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions kroma-validator/challenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,22 +600,17 @@ func (c *Challenger) handleChallenge(outputIndex *big.Int, asserter common.Addre

// if challenger
if isChallenger && c.cfg.ChallengerEnabled {
if isOutputDeleted {
// if output has been already deleted, cancel challenge to refund pending bond
if status != chal.StatusChallengerTimeout {
tx, err := c.CancelChallenge(c.ctx, outputIndex)
if err != nil {
c.log.Error("failed to create cancel challenge tx", "err", err, "outputIndex", outputIndex)
continue
}
if err := c.submitChallengeTx(tx); err != nil {
c.log.Error("failed to submit cancel challenge tx", "err", err, "outputIndex", outputIndex)
continue
}
// if output has been already deleted, cancel challenge to refund challenger's bond
if isOutputDeleted && status != chal.StatusChallengerTimeout {
tx, err := c.CancelChallenge(c.ctx, outputIndex)
if err != nil {
c.log.Error("failed to create cancel challenge tx", "err", err, "outputIndex", outputIndex)
continue
}
if err := c.submitChallengeTx(tx); err != nil {
c.log.Error("failed to submit cancel challenge tx", "err", err, "outputIndex", outputIndex)
continue
}
// if output has been already deleted, terminate handling
c.log.Info("output is already deleted when handling challenge", "outputIndex", outputIndex)
return
}

// if output is already finalized, terminate handling
Expand Down

0 comments on commit 7310c11

Please sign in to comment.