input-output-hk / project-icarus-importer

Icarus, a reference implementation for a lightweight wallet developed by the IOHK Engineering Team.
Other
13 stars 10 forks source link

Fixed flipped boolean return #7

Closed SebastienGllmt closed 5 years ago

SebastienGllmt commented 6 years ago

Description

Sending the same valid transaction twice (such as may happen under poor networking conditions) will cause one transaction to succeed and the other to fail. This is expected behavior but the problem is that the resulting DB state is that the transaction "failed" despite it being properly included in the blockchain.

Fix: Flip incorrect boolean result of a function

Note: I think this solution exposes a race condition because it follows a two step process: 1) Poll the DB to see the status of the transaction 2) If success, don't override. Otherwise override However, what happens if after (1) returns that there is no "successful" transaction and before (2), the DB receives a "success" transaction.

Type of change

mirkoAlic commented 5 years ago

These changes were merge here: https://github.com/input-output-hk/project-icarus-importer/pull/10

thanks!