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

fix: cockpit search with tx hash shows tx page #1386

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

andremedeiros
Copy link
Collaborator

This issue was caused by a string to integer conversion. In JavaScript,
when converting a string that starts with 0 (which is the case for tx
hashes) to an integer using parseInt it will always yield 0. That,
combined with a block with number 0 would always return a block result
instead of the transaction.

> parseInt("0xluri", 10)
0

This PR checks if the resulting number equals the string that was
provided on top of checking for the block number.

This issue was caused by a string to integer conversion. In JavaScript,
when converting a string that starts with `0` (which is the case for tx
hashes) to an integer using `parseInt` it will always yield 0. That,
combined with a block with number 0 would always return a block result
instead of the transaction.

```
> parseInt("0xluri", 10)
0
```

This PR checks if the resulting number equals the string that was
provided on top of checking for the block number.
@andremedeiros andremedeiros requested a review from a team March 4, 2019 12:46
@michaelsbradleyjr
Copy link
Contributor

Nice one! 💯

@michaelsbradleyjr michaelsbradleyjr requested a review from a team March 4, 2019 14:21
@andremedeiros andremedeiros merged commit 891174e into master Mar 5, 2019
@andremedeiros andremedeiros deleted the fix/cockpit-shows-transaction-page branch March 5, 2019 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants