spesmilo/electrum — pull request #771 by dabura667 (2014-07-26 05:57:22+00:00)
Title: Loop through inputs to decide change addr

Fixes (?) #769

This pull request will loop through the inputs, and send to the change address of the first non-imported-key account that is there. If all inputs are imported, then it will send to `inputs[-1]['address']` as normal.

It may be better to change `if not self.use_change or account == IMPORTED_ACCOUNT:` to `if not self.use_change:` if the preference for use_change could be followed regardless. (The sweep function was added... so maybe this is no longer necessary)