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

Commit

Permalink
cancel reverted draft
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszos4chain committed Nov 13, 2023
1 parent 325026e commit 520805f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions action_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ func (c *Client) RevertTransaction(ctx context.Context, id string) error {
}
}

// cancel draft tx
draftTransaction.Status = DraftStatusCanceled
if err = draftTransaction.Save(ctx); err != nil {
return err
}

// cancel sync transaction
var syncTransaction *SyncTransaction
if syncTransaction, err = GetSyncTransactionByID(ctx, transaction.ID, c.DefaultModelOptions()...); err != nil {
Expand All @@ -481,6 +487,7 @@ func (c *Client) RevertTransaction(ctx context.Context, id string) error {
transaction.XpubOutputValue = XpubOutputValue{"reverted": 0}
transaction.DeletedAt.Valid = true
transaction.DeletedAt.Time = time.Now()

err = transaction.Save(ctx) // update existing record

return err
Expand Down

0 comments on commit 520805f

Please sign in to comment.