Skip to content

Commit

Permalink
maybe fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm committed Dec 11, 2024
1 parent 65a231f commit 533b4f1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion aggsender/db/aggsender_db_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,28 @@ func (a *AggSenderSQLStorage) moveCertificateToHistoryOrDelete(tx db.Querier,

// DeleteCertificate deletes a certificate from the storage
func (a *AggSenderSQLStorage) DeleteCertificate(ctx context.Context, certificateID common.Hash) error {
if err := deleteCertificate(tx, certificateID); err != nil {
tx, err := db.NewTx(ctx, a.db)
if err != nil {
return err
}
defer func() {
if err != nil {
if errRllbck := tx.Rollback(); errRllbck != nil {
a.logger.Errorf(errWhileRollbackFormat, errRllbck)
}
}
}()

if err = deleteCertificate(tx, certificateID); err != nil {
return err
}

if err = tx.Commit(); err != nil {
return err
}

a.logger.Debugf("deleted certificate - CertificateID: %s", certificateID)

return nil
}

Expand Down

0 comments on commit 533b4f1

Please sign in to comment.