Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle deletion multisig txn #1466

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading