Skip to content

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