Page MenuHomePhabricator

[electrum] rely on pycryptodomex being installed in hash_160
ClosedPublic

Authored by PiRK on Jun 27 2023, 12:53.

Details

Summary

The code was wrong and didn't work on systems with OpenSSL compiled without ripemd160 (which is now the case for the OpenSSL 3.0 default build), because the try except clauses were not properly nested.

It should have been:

try:
   ...
except ValueError:
    try:
        ...
    except ImportError:
        ...

The last fallback option, which is a slow pure-python implementation (slowdown very noticeable in wallets with many addresses), is no longer really needed as we just made pycryptodomex an official dependency.

Note that we also have a (better maintained) ripemd pure-python implementation in the node's test framework, so this also deduplicates code in the monorepo.

Depends on D14132

Test Plan
pip uninstall pycryptodomex
pip install -r contrib/requirements/requirements.txt
python run_tests.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable