From c5a8b40d9c8b7a0104ea9894b07eb3ca42b530af Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 28 Apr 2023 12:02:04 +0300 Subject: [PATCH] fix(wallet) don't delete pending transactions for multi-transaction This is done in Nim after the watched pending transaction changes state. Note: tried to delete all transactions, not only multi-transaction, as soon as the state is downloaded but it didn't work: noticed crashes with minted transactions after restart. Updates status-desktop #10474 --- services/wallet/transfer/commands.go | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/services/wallet/transfer/commands.go b/services/wallet/transfer/commands.go index 271a96806..3731e5ec2 100644 --- a/services/wallet/transfer/commands.go +++ b/services/wallet/transfer/commands.go @@ -362,24 +362,13 @@ func (c *transfersCommand) Run(ctx context.Context) (err error) { // Update MultiTransactionID from pending entry for index := range allTransfers { transfer := &allTransfers[index] - if transfer.MultiTransactionID == NoMultiTransactionID { - entry, err := c.transactionManager.GetPendingEntry(c.chainClient.ChainID, transfer.ID) - if err != nil { - if err == sql.ErrNoRows { - log.Info("Pending transaction not found for", "chainID", c.chainClient.ChainID, "transferID", transfer.ID) - } else { - return err - } - } else { - transfer.MultiTransactionID = entry.MultiTransactionID - if transfer.Receipt != nil && transfer.Receipt.Status == types.ReceiptStatusSuccessful { - // TODO: Nim logic was deleting pending previously, should we notify UI about it? - err := c.transactionManager.DeletePending(c.chainClient.ChainID, transfer.ID) - if err != nil { - return err - } - } - } + entry, err := c.transactionManager.GetPendingEntry(c.chainClient.ChainID, transfer.ID) + if err == nil { + // Propagate the MultiTransactionID, in case the pending entry was a multi-transaction + transfer.MultiTransactionID = entry.MultiTransactionID + } else if err != sql.ErrNoRows { + log.Error("GetPendingEntry error", "error", err) + return err } }