Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Don't store ATX if check malicious fails
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed May 7, 2024
1 parent a1173d8 commit 47f7873
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions activation/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,13 +565,16 @@ func (h *Handler) storeAtx(ctx context.Context, atx *types.VerifiedActivationTx)
var nonce *types.VRFPostIndex
var proof *mwire.MalfeasanceProof
err := h.cdb.WithTx(ctx, func(tx *sql.Tx) error {
var err1, err2 error
proof, err1 = h.checkMalicious(ctx, tx, atx)
nonce, err2 = atxs.AddGettingNonce(tx, atx)
if err2 != nil && !errors.Is(err2, sql.ErrObjectExists) {
err2 = fmt.Errorf("add atx to db: %w", err2)
var err error
proof, err = h.checkMalicious(ctx, tx, atx)
if err != nil {
return fmt.Errorf("check malicious: %w", err)
}
return errors.Join(err1, err2)
nonce, err = atxs.AddGettingNonce(tx, atx)
if err != nil && !errors.Is(err, sql.ErrObjectExists) {
return fmt.Errorf("add atx to db: %w", err)
}
return nil
})
if err != nil {
return nil, fmt.Errorf("store atx: %w", err)
Expand Down

0 comments on commit 47f7873

Please sign in to comment.