HomePhabricator

[electrum] remove more bytes <--> hex conversions in bitcoin.py

Description

[electrum] remove more bytes <--> hex conversions in bitcoin.py

Summary:
This fixes all the code using bfh (bytes.fromhex) to expect bytes and return bytes. These are all low-level functions that should not deal with data encoding and decoding, so let's make it the responsibility of higher-level code to pass the correct type.

Note that there are still remaining functions using bh2u (binascii.hexlify(x).decode("ascii")). I'm leaving these untouched for the moment, to keep this diff manageable.

Depends on D14463

Test Plan:
python test_runner.py

Run the application, open, close and reopen an encrypted wallet to test the encrypt_message function.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
PiRKAuthored on Sep 11 2023, 07:53
PiRKPushed on Sep 11 2023, 13:36
Reviewer
Restricted Project
Differential Revision
D14464: [electrum] remove more bytes <--> hex conversions in bitcoin.py
Parents
rABC5bbcbbc7ccb8: [electrum] remove uneccessary hex <--> bytes conversions in bitcoin.py
Branches
Unknown
Tags
Unknown