Browse Source

Fix docstring display.

283
Neil Booth 9 years ago
parent
commit
36aaad392d
  1. 7
      gui/qt/main_window.py
  2. 26
      lib/coinchooser.py

7
gui/qt/main_window.py

@ -2583,11 +2583,14 @@ class ElectrumWindow(QMainWindow, PrintError):
nz.valueChanged.connect(on_nz)
gui_widgets.append((nz_label, nz))
def fmt_docs(key, klass):
lines = [ln.lstrip(" ") for ln in klass.__doc__.split("\n")]
return '\n'.join([key, "", " ".join(lines)])
choosers = sorted(COIN_CHOOSERS.keys())
chooser_name = self.wallet.coin_chooser_name(self.config)
msg = _('Choose coin (UTXO) selection method. The following are available:\n\n')
msg += '\n\n'.join(key + ": " + klass.__doc__
for key, klass in COIN_CHOOSERS.items())
msg += '\n\n'.join(fmt_docs(*item) for item in COIN_CHOOSERS.items())
chooser_label = HelpLabel(_('Coin selection') + ':', msg)
chooser_combo = QComboBox()
chooser_combo.addItems(choosers)

26
lib/coinchooser.py

@ -117,10 +117,9 @@ class CoinChooserBase(PrintError):
return tx
class CoinChooserClassic(CoinChooserBase):
'''
The classic electrum algorithm. Chooses coins starting with
the oldest that are sufficient to cover the spent amount, and
then removes any unneeded starting with the smallest in value.'''
'''The classic electrum algorithm. Chooses coins starting with the
oldest that are sufficient to cover the spent amount, and then
removes any unneeded starting with the smallest in value.'''
def keys(self, coins):
return [coin['prevout_hash'] + ':' + str(coin['prevout_n'])
@ -179,19 +178,18 @@ class CoinChooserRandom(CoinChooserBase):
return winner
class CoinChooserPrivacy(CoinChooserRandom):
'''
Attempts to better preserve user privacy. First, if any coin is
'''Attempts to better preserve user privacy. First, if any coin is
spent from a user address, all coins are. Compared to spending
from other addresses to make up an amount, this reduces
information leakage about sender holdings. It also helps to
reduce blockchain UTXO bloat, and reduce future privacy loss
that would come from reusing that address' remaining UTXOs.
Second, it penalizes change that is quite different to the sent
amount. Third, it penalizes change that is too big. Fourth, it
breaks large change up into amounts comparable to the spent
amount. Finally, change is rounded to similar precision to
sent amounts. Extra change outputs and rounding might raise
the transaction fee slightly'''
reduce blockchain UTXO bloat, and reduce future privacy loss that
would come from reusing that address' remaining UTXOs. Second, it
penalizes change that is quite different to the sent amount.
Third, it penalizes change that is too big. Fourth, it breaks
large change up into amounts comparable to the spent amount.
Finally, change is rounded to similar precision to sent amounts.
Extra change outputs and rounding might raise the transaction fee
slightly.'''
def keys(self, coins):
return [coin['address'] for coin in coins]

Loading…
Cancel
Save