TLDR: If a transaction fails (ie. out of gas) sub.unsubscribe() is never called and blockTracker continues to poll for blocks indefinitely
startWatching inside web3-core-method is called. It either sends eth_subscribe if it is available on the provider, or starts polling for new blocks. Steps 1. and 2. work as expected. However, if a tx fails (step 3.), only 1 confirmation is emitted (this may be by design). After that, the defer.eventEmitter.listeners('confirmation').length is equal to 0, never entering the if, and never stopping the subscription.
else { sub.unsubscribe(); } herecanUnsubscribe hereI can set up a mini repo with a test if required.
web3 packages, including web3-core-method: 1.2.11
web3-provider-engine: 15.0.12 -> https://github.com/sterlu/web3-provider-engine/tree/disable-polling
In my tests, I've been using web3-provider-engine, but a forked version which disables constant block polling on provider creation. This is how I was able to observe the actual changes in a number of requests. This is a separate issue on web3-provider-engine that I'll try to address in a separate issue/PR.
Hi, I see a rewrite of mentioned packages is planned. I'd be happy to provide a PR for this in the meantime if someone has the time and will to merge it.
This same happens when replacing transactions. The replaced ones are still polled for a receipt until max is reached
@krychla1 while that is a different (and more difficult) problem, it might be useful to have an option to stop polling for receipt on the returned promi-event.
@sterlu happily accepting PRs!
PS: Love defisaver
Transaction replacements are actually a much bigger problem that I created an EIP to solve it.