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

Updated lib/util.js for avoiding TypeError: Not a string or buffer #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

statefull
Copy link

Avoid error TypeError: Not a string or buffer when calling api request pubkeys/register?keys=

Explanation:

In addressToPubKeyHash decoding a base58 address (bitcoin address) returns a byte array but twoSha256, concretely, sha256 requires a string or a buffer, so, to avoid errors performing sha256, the returned byte array is converted to a buffer.

In addressToPubKeyHash decoding a base58 address (bitcoin address) returns a byte array but twoSha256, concretely, sha256 requires a string or a buffer, so, to avoid errors performing sha256, the returned byte array is converted to a buffer.
@MidnightLightning
Copy link
Owner

It appears that function isn't really used in the application at all (I can't find a reference to addressToPubKeyHash other than its declaration). Are you using it in part of a child implementation that's failing? I'm wondering if the proper response is to remove it entirely if it's not used as part of the application.

@statefull
Copy link
Author

Hi,

Yes, it is used in exit API at mods/exit/pubkeys.js line 254

// Convert Bitcoin address to pubkey hash
var pubKeyHash = Util.addressToPubKeyHash(keys[i]);

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.

2 participants