HomePhabricator

[electrum] split get_addr_io into get_address_unspent and get_address_spent

Description

[electrum] split get_addr_io into get_address_unspent and get_address_spent

Summary:
The two operations were combined into a single function to factor the get_address_history call, but it turns out that in the slow cases that I encountered that call accounts for a minor part of the call time. The first operation is the real bottleneck in large single address wallets. For wallets that also produce a lot of outputs, both operations would probably be slow.

Some callsites only really need one of the two ouputs, most notably the add_input_info which has been found to be a source of GUI freezing.

Split the operations into their own functions that take the address history as a parameter, and keep the original function as a shortcut for when both outputs are actually needed.

Document and add typehints to all touched functions.

Remove an unused and poorly named get_addr_received function.

Test Plan:
python test_runner.py

Test the application, use the send tab tosend a transaction or paste an address in the destination and an amount in the Amount tab which triggers fee estimation to exercise the changed codepaths.

Verify that get_addr_received is not used anywhere:
grep -r get_addr_received .

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Subscribers: bytesofman

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

Details

Provenance
PiRKAuthored on Jul 11 2023, 10:11
PiRKPushed on Jul 12 2023, 20:49
Reviewer
Restricted Project
Differential Revision
D14248: [electrum] split get_addr_io into get_address_unspent and get_address_spent
Parents
rABC2bf685cc6b8b: [electrum] don't run the unit tests twice
Branches
Unknown
Tags
Unknown