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

Stop listening provider.waitForTransaction #410

Closed
safead opened this Issue Jan 31, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@safead
Copy link

safead commented Jan 31, 2019

After start to waiting a transaction to be mined:

wallet.provider.waitForTransaction( tx.hash )

how to cancel (break) this process?

wallet.provider.listenerCount( tx.hash ) shows "0",
wallet.provider.removeAllListeners( tx.hash ) do not working. The requests to provider continue flow until tx is mined. I want to have a chance to cancel the waiting process. Thank you.

@ricmoo ricmoo added the investigate label Jan 31, 2019

@ricmoo

This comment has been minimized.

Copy link
Member

ricmoo commented Jan 31, 2019

That is odd. I am planning to do polish off a few Provider-related issues tomorrow, I will look into this to figure out why; you should certainly be able to remove the listener.

Do you have the same problem if you use provider.once(tx.hash) as well?

@safead

This comment has been minimized.

Copy link
Author

safead commented Feb 1, 2019

No, 'on' & 'once' can be cancelled without any problems. Only 'waitForTransaction' is not affected

@safead

This comment has been minimized.

Copy link
Author

safead commented Feb 1, 2019

Also can you please enchance the 'removeAllListeners' without parameters to cancel all current listeners? Without the need to cancel each listener with it's initial 'eventType' ?

wallet.instance.provider.removeAllListeners(); // remove all listeners from this provider

@ricmoo

This comment has been minimized.

Copy link
Member

ricmoo commented Feb 1, 2019

Awesome! Thanks! I’ll roll it into a fix for another listener issue I’m fixing tomorrow.

The removeAllListeners request seems totally fair, I’ll also look into that tomorrow too. I use to allow that in a previous version, I need to look at my notes as to why I removed that ability, but it may have just been an oversight when migrating to TypeScript.

@ricmoo ricmoo added the on-deck label Feb 4, 2019

@ricmoo

This comment has been minimized.

Copy link
Member

ricmoo commented Feb 12, 2019

I've found the issue. I'm just figuring out the most concise and efficient way to fix it. :)

@ricmoo ricmoo added bug and removed investigate labels Feb 12, 2019

@ricmoo ricmoo self-assigned this Feb 12, 2019

ricmoo added a commit that referenced this issue Feb 12, 2019

@ricmoo

This comment has been minimized.

Copy link
Member

ricmoo commented Feb 12, 2019

This is fixed in 4.0.25. Try it out and let me know if you still have any problems.

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.