HomePhabricator

[electrum] fix and add tyephints in base58 decoding code

Description

[electrum] fix and add tyephints in base58 decoding code

Summary:
The return type in serialize_privkey was wrong, it is a Base58 (WIF) encoded string, not bytes.
Also base_decode may return None if the result does not fit in the expected length, and DecodeBase58Check needs to bail out early when this happens instead of trying to slice None.

Test Plan:
python test_runner.py

Check that these particular errors are now fixed wrt to mypy:
mypy --ignore-missing-imports | grep "^electrumabc/bitcoin.py

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
PiRKAuthored on Nov 17 2023, 07:54
PiRKPushed on Nov 17 2023, 12:44
Reviewer
Restricted Project
Differential Revision
D14807: [electrum] fix and add tyephints in base58 decoding code
Parents
rABC1fbafada93e7: [electrum] only increment the aux key index if we know it has been used
Branches
Unknown
Tags
Unknown