-
Notifications
You must be signed in to change notification settings - Fork 809
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
Quit if native bcrypto bindings are missing #729
Conversation
As using JavaScript for many core operations such as However, I'm not sure that this is the correct place for the check, and seems like it should be part of the build and install. For example, secp256k1-node gives a warning during install if the build fails, and I think there have been specific environment variables to have it error in specific cases. Also related pull requests: |
Are you suggesting a change to I do like the idea of this PR because users should not end up running the JS backend if they did not intend to. |
@tynes see bcoin-org/bcrypto#9 (comment) |
Okay, yeah there is a case where install may not have been run. Switching nodejs versions may be one of those cases. I ran into this the other day when I saw unusually very slow block verification times, and then |
This comment has been minimized.
This comment has been minimized.
Just noticed this commit in hsd: Adds the same check as this PR, but in |
So, the idea of putting the backend check in |
Ok I replaced the commit in this PR with a port of the hsd commit. Just changed To test:
|
Quit if native bcrypto bindings are missing
So this has already been helpful, and warnings will appear if switching between nodejs versions and not rebuilding. |
This addresses user concern #572
and replaces bcoin-org/bcrypto#9
Test by moving or renaming the
build
directory inbcrypto
which will force bcrypto to use nodejs crypto or proprietary crypto scripts for everything.This PR throws an Error during
handleOpen()
that the bindings could not be found unless user explicitly setsNODE_BACKEND=js
orNODE_BACKEND=node