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:
parent
8a95dab5eb
commit
c5a8b40d9c
|
@ -362,26 +362,15 @@ 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 {
|
||||||
if err == sql.ErrNoRows {
|
// Propagate the MultiTransactionID, in case the pending entry was a multi-transaction
|
||||||
log.Info("Pending transaction not found for", "chainID", c.chainClient.ChainID, "transferID", transfer.ID)
|
|
||||||
} else {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
transfer.MultiTransactionID = entry.MultiTransactionID
|
transfer.MultiTransactionID = entry.MultiTransactionID
|
||||||
if transfer.Receipt != nil && transfer.Receipt.Status == types.ReceiptStatusSuccessful {
|
} else if err != sql.ErrNoRows {
|
||||||
// TODO: Nim logic was deleting pending previously, should we notify UI about it?
|
log.Error("GetPendingEntry error", "error", err)
|
||||||
err := c.transactionManager.DeletePending(c.chainClient.ChainID, transfer.ID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(allTransfers) > 0 {
|
if len(allTransfers) > 0 {
|
||||||
err = c.db.SaveTransfersMarkBlocksLoaded(c.chainClient.ChainID, c.address, allTransfers, []*big.Int{c.block})
|
err = c.db.SaveTransfersMarkBlocksLoaded(c.chainClient.ChainID, c.address, allTransfers, []*big.Int{c.block})
|
||||||
|
|
Loading…
Reference in New Issue