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
This commit is contained in:
Stefan 2023-04-28 12:02:04 +03:00 committed by Stefan Dunca
parent 8a95dab5eb
commit c5a8b40d9c
1 changed files with 7 additions and 18 deletions

View File

@ -362,24 +362,13 @@ func (c *transfersCommand) Run(ctx context.Context) (err error) {
// Update MultiTransactionID from pending entry // Update MultiTransactionID from pending entry
for index := range allTransfers { for index := range allTransfers {
transfer := &allTransfers[index] transfer := &allTransfers[index]
if transfer.MultiTransactionID == NoMultiTransactionID { entry, err := c.transactionManager.GetPendingEntry(c.chainClient.ChainID, transfer.ID)
entry, err := c.transactionManager.GetPendingEntry(c.chainClient.ChainID, transfer.ID) if err == nil {
if err != nil { // Propagate the MultiTransactionID, in case the pending entry was a multi-transaction
if err == sql.ErrNoRows { transfer.MultiTransactionID = entry.MultiTransactionID
log.Info("Pending transaction not found for", "chainID", c.chainClient.ChainID, "transferID", transfer.ID) } else if err != sql.ErrNoRows {
} else { log.Error("GetPendingEntry error", "error", err)
return err 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
}
}
}
} }
} }