Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Fix confirmation check after transaction getting stuck in a loop in some situations #4876

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,4 +533,4 @@ Released with 1.0.0-beta.37 code base.

### Fixed
- Fix jsonrpc payload and response types (#4743) (#4761)

- Fix confirmation check not ever finishing in some cases
4 changes: 2 additions & 2 deletions packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor

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.

var block;

// If there was an immediately retrieved receipt, it's already
Expand Down Expand Up @@ -339,7 +339,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload) {
}
canUnsubscribe = false;

if (confirmationCount === method.transactionConfirmationBlocks + 1) { // add 1 so we account for conf 0
if (confirmationCount >= method.transactionConfirmationBlocks + 1) { // add 1 so we account for conf 0
sub.unsubscribe();
defer.eventEmitter.removeAllListeners();
}
Expand Down