Skip to content

Commit

Permalink
handle deletion multisig txn
Browse files Browse the repository at this point in the history
  • Loading branch information
charymalloju committed Nov 12, 2024
1 parent 2e5efbb commit 0b9737e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/handler/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ func (h *Handler) DeleteTransaction(c echo.Context) error {

// Fetch signed_at before attempting to delete, to avoid issues if the transaction does not exist
var signedAt time.Time
row := h.DB.QueryRow(`SELECT signed_at FROM transactions WHERE id=$1 AND multisig_address=$2`, txId, address)
err = row.Scan(&signedAt)
var status string
err = h.DB.QueryRow(`SELECT signed_at,status FROM transactions WHERE id=$1 AND multisig_address=$2`, txId, address).Scan(&signedAt, &status)
if err != nil {
if err == sql.ErrNoRows {
return c.JSON(http.StatusNotFound, model.ErrorResponse{
Expand All @@ -545,7 +545,7 @@ func (h *Handler) DeleteTransaction(c echo.Context) error {
}

// Clear signatures for transactions with signed_at > txSignedAt
if !signedAt.IsZero() {
if !signedAt.IsZero() && status == "PENDING" {
_, err = h.DB.Exec(`UPDATE transactions SET signatures='[]'::jsonb WHERE multisig_address=$1 AND signed_at > $2 and status='PENDING'`, address, signedAt)
if err != nil {
return c.JSON(http.StatusInternalServerError, model.ErrorResponse{
Expand Down

0 comments on commit 0b9737e

Please sign in to comment.