Fix crash on missing ripemd160 hash function; add troubleshooting guide

This commit is contained in:
Brian McGrail 2025-06-26 23:17:06 -05:00
parent e7666f4894
commit 74dfea1e2f
2 changed files with 21 additions and 1 deletions

View file

@ -54,3 +54,16 @@ The documentation for the API can be found [here](https://lbry.tech/api/sdk).
Daemon defaults, ports, and other settings are documented [here](https://lbry.tech/resources/daemon-settings).
Settings can be configured using a daemon-settings.yml file. An example can be found [here](https://github.com/lbryio/lbry-sdk/blob/master/example_daemon_settings.yml).
## Troubleshooting
### Error: unsupported hash type 'ripemd160'
If you see this error when running `lbrynet start`, it likely means your OpenSSL or Python installation is missing RIPEMD160 support.
To fix it:
- Ensure you are using a version of Python compiled with OpenSSL support.
- On Ubuntu/Debian, try: `sudo apt install libssl-dev` and reinstall Python.
- Alternatively, use a precompiled Python version (e.g., via `pyenv install 3.8.18` after `libssl-dev` is installed).

View file

@ -15,11 +15,18 @@ def sha512(x):
def ripemd160(x):
""" Simple wrapper of hashlib ripemd160. """
h = hashlib.new('ripemd160')
try:
h = hashlib.new('ripemd160')
except ValueError as e:
raise RuntimeError(
"Your Python/OpenSSL installation does not support RIPEMD160. "
"Try reinstalling Python with full OpenSSL support."
) from e
h.update(x)
return h.digest()
def double_sha256(x):
""" SHA-256 of SHA-256, as used extensively in bitcoin. """
return sha256(sha256(x))