Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

fix: handle bignumber conversion on hash without prefix #1137

Merged
merged 1 commit into from
Mar 20, 2019
Merged

fix: handle bignumber conversion on hash without prefix #1137

merged 1 commit into from
Mar 20, 2019

Conversation

andremedeiros
Copy link
Contributor

No description provided.

@@ -78,6 +78,8 @@ function toBN (value) {
} else if (value.indexOf && value.indexOf('0x') === 0) {
value = ethutil.unpad(value.replace('Ox', ''))
value = new BN(value === '' ? '0' : value, 16)
} else if (value.match(/[0-9a-f]*/)) {
value = new BN(value, 16)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if I need to ethutil.unpad hear too. @yann300, I'm open to suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I think you need it here

@andremedeiros
Copy link
Contributor Author

@yann300 fixed the logic, and I think I fixed a potential bug here too (you were replacing Ox instead of 0x in the original logic.

@yann300
Copy link
Collaborator

yann300 commented Mar 19, 2019

you were replacing Ox instead of 0x in the original logic.

!!

@yann300 yann300 merged commit 696567f into ethereum:master Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants