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

bugfix/dont modify current transactions #386

Merged
merged 6 commits into from
Mar 12, 2021

Conversation

estebanmino
Copy link
Contributor

When fetching transactions from API, if a fetch and a transaction are made in in the same block we have register of, the API transaction will overwrite the one from the app.

Example

  1. I'm sending a swap transaction with id (random()) 1 and transaction hash 0x1 coming from TransactionController.addTransaction
  2. Mobile app saves the swap information needed to display to users
  3. When transaction is confirmed, fetching the API will get the same tx with transaction hash 0x1, as normalizeTx is generating a new id 2 (random() again)
  4. We ignore local transactions in favor of the remote transactions (here)
  5. Transaction with id 2 and hash 0x1 will be saved.

For swaps and also if we want to know which transactions are coming from the app, is the wrong behavior because we'd like to save the original transaction with id 1, because we have other information depending on that original transaction.

So with this PR the idea would be to save local transactions first and then remote transactions, not the inverse.

@estebanmino estebanmino requested a review from a team as a code owner March 12, 2021 03:44
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@estebanmino estebanmino merged commit 8cb81d5 into develop Mar 12, 2021
@estebanmino estebanmino deleted the bugfix/dont-modify-current-transactions branch March 12, 2021 15:23
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* fix

* tests

* bettercode

* format
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* fix

* tests

* bettercode

* format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants