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

Need a better example strategy to confirm a transaction is complete. #328

Open
snowkidind opened this issue Oct 20, 2020 · 1 comment
Open

Comments

@snowkidind
Copy link

Regarding:
https://github.com/omgnetwork/omg-js/blob/master/packages/omg-js-util/src/waitForChildchainBalance.js

After playing with this in my integration I've concluded that there are a lot of problems with this, but I will bring forth a couple:

  1. If the recipient address automatically combines UTXO's it might timeout
  2. If the recipient address receives another deposit, withdraw, anything really, during the waiting period the function will timeout.

Suggested fixes:

  1. Allow for polling of pending transactions.
  2. Improve upon this strategy to handle failure cases by checking for other recent transactions, and reacting accordingly.
@nicholasmueller
Copy link
Contributor

nicholasmueller commented Oct 28, 2020

You should not rely on this method to wait for transaction confirmation. This helper is really there to aid in some of the testing the library does when the transactions are triggered in a controlled manner in a private chain. This would be very fragile in a public environment due to the reasons you stated.

The current approach for waiting for transaction confirmation in some of the client integrations is to poll transaction.all and wait for a known sent transaction to show up there. There is work being done on the Watcher side to have pending state returned so we don't have to rely on these kinds of workarounds. Hopefuly we can remove this function in the future for something more robust.

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

No branches or pull requests

2 participants