HomePhabricator

[electrum] secp256k1: Improve warning message by adding path and exception…

Description

[electrum] secp256k1: Improve warning message by adding path and exception details

Summary:
To be better able to diagnose loading failures of libsecp256k1-0.dll
this patch adds a more detailed warning print to the failure case where
all tried paths and their errors are listed.

This is a backport of electroncash#2712

Note that sys.exc_info()[0] is not always very useful (it often just says OSError), so I changed the backport to print an even more detailled error.

Test Plan:
With secp256k1 not available on the machine (on Linux delete electrum/electrumabc/libsecp256k1.so.0)

$ ./electrum-abc -v
[secp256k1] warning: libsecp256k1 library failed to load
[secp256k1] warning: loading from /home/pablo/dev/bitcoin-abc/electrum/electrumabc/libsecp256k1.so.0 failed with: /home/pierre/dev/bitcoin-abc/electrum/electrumabc/libsecp256k1.so.0: cannot open shared object file: No such file or directory
[secp256k1] warning: loading from libsecp256k1.so.0 failed with: libsecp256k1.so.0: cannot open shared object file: No such file or directory
[ecc] info: libsecp256k1 library not available, falling back to python-ecdsa. This means signing operations will be slower. Try running:
...

without this diff, the output is less verbose and less useful:

$ ./electrum-abc -v
[secp256k1] warning: libsecp256k1 library failed to load
[ecc] info: libsecp256k1 library not available, falling back to python-ecdsa. This means signing operations will be slower. Try running:

Reviewers: #bitcoin_abc, Fabien, bytesofman

Reviewed By: #bitcoin_abc, Fabien, bytesofman

Subscribers: bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D14701

Details

Provenance
EchterAgoAuthored on Oct 6 2023, 04:09
PiRKCommitted on Oct 31 2023, 07:26
PiRKPushed on Oct 31 2023, 07:26
Reviewer
Restricted Project
Differential Revision
D14701: [electrum] secp256k1: Improve warning message by adding path and exception details
Parents
rABC56eb12dfb561: [electrum] Fix various strings that were wrong, inconsistent or not translatable
Branches
Unknown
Tags
Unknown