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.