Clarify preferences dialog:

* rename 'Oldest First' policy as Priority
 * show multiple change and fee multiplier on separate lines
This commit is contained in:
ThomasV 2016-01-15 09:02:03 +01:00
parent 6bf91b8ae2
commit eb085c2e23
2 changed files with 26 additions and 16 deletions

View File

@ -2587,8 +2587,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
nz.valueChanged.connect(on_nz) nz.valueChanged.connect(on_nz)
gui_widgets.append((nz_label, nz)) gui_widgets.append((nz_label, nz))
msg = _('Fee per kilobyte of transaction.') + '\n' \ msg = '\n'.join([
+ _('If you enable dynamic fees, this parameter will be used as upper bound.') _('Fee per kilobyte of transaction.'),
_('If you enable dynamic fees, this parameter will be used as upper bound.')
])
fee_label = HelpLabel(_('Transaction fee per kb') + ':', msg) fee_label = HelpLabel(_('Transaction fee per kb') + ':', msg)
fee_e = BTCkBEdit(self.get_decimal_point) fee_e = BTCkBEdit(self.get_decimal_point)
fee_e.setAmount(self.config.get('fee_per_kb', bitcoin.RECOMMENDED_FEE)) fee_e.setAmount(self.config.get('fee_per_kb', bitcoin.RECOMMENDED_FEE))
@ -2607,13 +2609,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
dynfee_cb.setToolTip(_("Use a fee per kB value recommended by the server.")) dynfee_cb.setToolTip(_("Use a fee per kB value recommended by the server."))
dynfee_sl = QSlider(Qt.Horizontal, self) dynfee_sl = QSlider(Qt.Horizontal, self)
dynfee_sl.setValue(self.config.get('fee_factor', 50)) dynfee_sl.setValue(self.config.get('fee_factor', 50))
dynfee_sl.setToolTip("Fee Multiplier. Min = 50%, Max = 150%") dynfee_sl.setToolTip("Min = 50%, Max = 150%")
tx_widgets.append((dynfee_cb, dynfee_sl)) tx_widgets.append((dynfee_cb, None))
multiplier_label = HelpLabel(_('Fee multiplier'), _("Multiply the recommended fee/kb value by a constant factor. Min = 50%, Max = 150%"))
tx_widgets.append((multiplier_label, dynfee_sl))
def update_feeperkb(): def update_feeperkb():
fee_e.setAmount(self.wallet.fee_per_kb(self.config)) fee_e.setAmount(self.wallet.fee_per_kb(self.config))
b = self.config.get('dynamic_fees') b = self.config.get('dynamic_fees')
dynfee_sl.setHidden(not b) dynfee_sl.setEnabled(b)
multiplier_label.setEnabled(b)
fee_e.setEnabled(not b) fee_e.setEnabled(not b)
def fee_factor_changed(b): def fee_factor_changed(b):
self.config.set_key('fee_factor', b, False) self.config.set_key('fee_factor', b, False)
@ -2754,13 +2759,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.wallet.multiple_change = multiple self.wallet.multiple_change = multiple
self.wallet.storage.put('multiple_change', multiple) self.wallet.storage.put('multiple_change', multiple)
multiple_change = self.wallet.multiple_change multiple_change = self.wallet.multiple_change
multiple_cb = QCheckBox(_('Multiple')) multiple_cb = QCheckBox(_('Use multiple change addresses'))
multiple_cb.setEnabled(self.wallet.use_change) multiple_cb.setEnabled(self.wallet.use_change)
multiple_cb.setToolTip(_('If appropriate use up to 3 change addresses.\nThis might raise the transaction fee slightly.')) multiple_cb.setToolTip('\n'.join([
_('In some cases, use up to 3 change addresses in order to obfuscate the recipient address.'),
_('This may result in higher transactions fees.')
]))
multiple_cb.setChecked(multiple_change) multiple_cb.setChecked(multiple_change)
multiple_cb.stateChanged.connect(on_multiple) multiple_cb.stateChanged.connect(on_multiple)
tx_widgets.append((usechange_cb, multiple_cb)) tx_widgets.append((usechange_cb, None))
tx_widgets.append((multiple_cb, None))
showtx_cb = QCheckBox(_('View transaction before signing')) showtx_cb = QCheckBox(_('View transaction before signing'))
showtx_cb.setChecked(self.show_before_broadcast()) showtx_cb.setChecked(self.show_before_broadcast())
@ -2788,7 +2796,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
chooser_label = HelpLabel(_('Coin selection') + ':', msg) chooser_label = HelpLabel(_('Coin selection') + ':', msg)
chooser_combo = QComboBox() chooser_combo = QComboBox()
chooser_combo.addItems(choosers) chooser_combo.addItems(choosers)
chooser_combo.setCurrentIndex(choosers.index(chooser_name)) i = choosers.index(chooser_name) if chooser_name in choosers else 0
chooser_combo.setCurrentIndex(i)
def on_chooser(x): def on_chooser(x):
chooser_name = choosers[chooser_combo.currentIndex()] chooser_name = choosers[chooser_combo.currentIndex()]
self.config.set_key('coin_chooser', chooser_name) self.config.set_key('coin_chooser', chooser_name)

View File

@ -160,9 +160,11 @@ class CoinChooserBase(PrintError):
return tx return tx
class CoinChooserOldestFirst(CoinChooserBase): class CoinChooserOldestFirst(CoinChooserBase):
'''The classic electrum algorithm. Chooses coins starting with the '''Maximize transaction priority. Select the oldest unspent
oldest that are sufficient to cover the spent amount, and then transaction outputs in your wallet, that are sufficient to cover
removes any unneeded starting with the smallest in value.''' the spent amount. Then, remove any unneeded inputs, starting with
the smallest in value.
'''
def keys(self, coins): def keys(self, coins):
return [coin['prevout_hash'] + ':' + str(coin['prevout_n']) return [coin['prevout_hash'] + ':' + str(coin['prevout_n'])
@ -228,8 +230,7 @@ class CoinChooserPrivacy(CoinChooserRandom):
reduce blockchain UTXO bloat, and reduce future privacy loss that reduce blockchain UTXO bloat, and reduce future privacy loss that
would come from reusing that address' remaining UTXOs. Second, it would come from reusing that address' remaining UTXOs. Second, it
penalizes change that is quite different to the sent amount. penalizes change that is quite different to the sent amount.
Third, it penalizes change that is too big. Transaction priority Third, it penalizes change that is too big.'''
might be less than if older coins were chosen.'''
def keys(self, coins): def keys(self, coins):
return [coin['address'] for coin in coins] return [coin['address'] for coin in coins]
@ -259,5 +260,5 @@ class CoinChooserPrivacy(CoinChooserRandom):
return penalty return penalty
COIN_CHOOSERS = {'Oldest First': CoinChooserOldestFirst, COIN_CHOOSERS = {'Priority': CoinChooserOldestFirst,
'Privacy': CoinChooserPrivacy} 'Privacy': CoinChooserPrivacy}