-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Fix confirmation check after transaction getting stuck in a loop in some situations #4876
Conversation
Fix a bug that allows for a confirmation check to never end in some situations, such as when using .once('subscribe') and some other situations
Pull Request Test Coverage Report for Build 2017898581
💛 - Coveralls |
Ok so apparently this also happens if you just... not subscribe to the |
Thanks @Darkhogg did you get time of adding test and fixing merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Darkhogg Please convert the draft PR to ready and then request the request again.
@@ -306,7 +306,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload) { | |||
} | |||
|
|||
// check if confirmation listener exists | |||
if (defer.eventEmitter.listeners('confirmation').length > 0) { | |||
if (!canUnsubscribe || defer.eventEmitter.listeners('confirmation').length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending items are ( tests cases and fixing merge conflicts ). There is no activity on this PR from contributor so closing. @Darkhogg feel free to reopen and fix issues in this PR when have time.
Description
Sometimes, the checkConfirmation login became completely stuck and unable to exit properly, wasting a lot of CPU cycles and API calls on nothing.
I've seen this behaviour in situations where the generations of new blocks was slow (in which case polling kicks in and both polling and subscription remained working, but only one of them would ever finish) and when using
.once('confirmation')
on the result of asendSignedTransaction
call.This PR fixes the afforementioned cases in the most simple way I came up with that doesn't break other stuff.
Type of change
Checklist:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:unit
with success.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
and testeddist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.