electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 641f23229d42d05a9003d6e4be36040d890f64a7
parent f271f65842e2adfe32406967872bbe6d2325d59a
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Fri, 15 Jan 2016 14:54:26 +0900

Add multiple change output preference

Limit to 3 if enabled.

Diffstat:
Mgui/qt/main_window.py | 16+++++++++++++++-
Mlib/wallet.py | 5++++-
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2744,9 +2744,23 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): if self.wallet.use_change != usechange_result: self.wallet.use_change = usechange_result self.wallet.storage.put('use_change', self.wallet.use_change) + multiple_cb.setEnabled(self.wallet.use_change) usechange_cb.stateChanged.connect(on_usechange) usechange_cb.setToolTip(_('Using change addresses makes it more difficult for other people to track your transactions.')) - tx_widgets.append((usechange_cb, None)) + + def on_multiple(x): + multiple = x == Qt.Checked + if self.wallet.multiple_change != multiple: + self.wallet.multiple_change = multiple + self.wallet.storage.put('multiple_change', multiple) + multiple_change = self.wallet.multiple_change + multiple_cb = QCheckBox(_('Multiple')) + multiple_cb.setEnabled(self.wallet.use_change) + multiple_cb.setToolTip(_('If appropriate, and the "privacy" coin chooser is selected, use up to 3 change addresses.')) + multiple_cb.setChecked(multiple_change) + multiple_cb.stateChanged.connect(on_multiple) + tx_widgets.append((usechange_cb, multiple_cb)) + showtx_cb = QCheckBox(_('View transaction before signing')) showtx_cb.setChecked(self.show_before_broadcast()) diff --git a/lib/wallet.py b/lib/wallet.py @@ -159,6 +159,8 @@ class Abstract_Wallet(PrintError): # saved fields self.seed_version = storage.get('seed_version', NEW_SEED_VERSION) self.use_change = storage.get('use_change',True) + self.multiple_change = storage.get('multiple_change', False) + self.use_encryption = storage.get('use_encryption', False) self.seed = storage.get('seed', '') # encrypted self.labels = storage.get('labels', {}) @@ -973,8 +975,9 @@ class Abstract_Wallet(PrintError): return tx # Let the coin chooser select the coins to spend + max_change = 3 if self.multiple_change else 1 coin_chooser = self.coin_chooser(config) - tx = coin_chooser.make_tx(coins, outputs, change_addrs, + tx = coin_chooser.make_tx(coins, outputs, change_addrs[:max_change], fee_estimator, dust_threshold) # Sort the inputs and outputs deterministically