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

PromiEvent event listener on confirmations not returning correct confirmation information #2418

Closed
joshstevens19 opened this issue Feb 25, 2019 · 2 comments · Fixed by #2466
Labels
Bug Addressing a bug Enhancement Includes improvements or optimizations

Comments

@joshstevens19
Copy link
Contributor

joshstevens19 commented Feb 25, 2019

Expected behavior

When i hook onto PromiEvent event listener on confirmations i get the correct confirmation number at the correct time not just random count of confirmations number every second.

Actual behavior

When i hook onto PromiEvent event listener on confirmations it seems its not inline with when the next block has been mined, on Rinkeby it's every 15 seconds but on web3 it returns the confirmation every second which is not correct.

web3.eth.sendSignedTransaction(rawTransaction)
.on(
            'confirmation',
            (confirmationNumber: number, receipt: TransactionReceipt) => {
              // fires new confirmation number up to 24 every second
            },
          )

It also states in the documentation that it stops the event listener firing after 12 confirmations yet it goes up to 24.

This should be in line with the proper confirmations number and fire correctly and not just return a fake confirmation number every second.

Versions

1.0.0-beta.46

@nivida
Copy link
Contributor

nivida commented Feb 25, 2019

Thanks for creating this issue!
This behavior is because you'are connected over a HttpProvider this means the NewHeadWatcher will just emit each second a new_head event. I thought about to improve it during the refactoring but didn't have the time. I will add a check which guarantees us that there was a confirmation. Thanks!

@nivida nivida added Enhancement Includes improvements or optimizations Bug Addressing a bug labels Feb 25, 2019
@ohopton
Copy link

ohopton commented Feb 25, 2019

Hey all.

Does this return the number of confirmations or just the number of blocks that have been mined since the transaction was mined?

What happens in the event of a re-org?

Apologies if this is the wrong place to ask questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug Enhancement Includes improvements or optimizations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants