URI: 
       tsending fixed - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 0693403358656f1e7d5453679f125ab48d7fb644
   DIR parent f02d18226bdf7f9463824e74c411ed9d113fc130
  HTML Author: Dmitry Sorokin <asfins@gmail.com>
       Date:   Sat,  4 Feb 2017 20:59:22 +0300
       
       sending fixed
       
       Diffstat:
         M gui/qt/main_window.py               |      28 ++++++++--------------------
         M gui/qt/paytoedit.py                 |       5 ++---
         M gui/qt/utxo_list.py                 |       6 ------
         M lib/coinchooser.py                  |       9 ++++++---
         M lib/commands.py                     |       4 ++--
         M lib/keystore.py                     |       4 ++--
         M lib/transaction.py                  |       2 +-
         M lib/wallet.py                       |       2 +-
       
       8 files changed, 22 insertions(+), 38 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -22,12 +22,6 @@
        # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
        # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        # SOFTWARE.
       -from __future__ import absolute_import
       -from __future__ import division
       -from __future__ import print_function
       -from __future__ import unicode_literals
       -
       -import six
        import sys, time, threading
        import os, json, traceback
        import shutil
       t@@ -44,6 +38,7 @@ from PyQt4.QtGui import *
        from PyQt4.QtCore import *
        import PyQt4.QtCore as QtCore
        
       +from lib.util import bh2u, bfh
        from . import icons_rc
        
        from electrum import keystore
       t@@ -850,7 +845,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                if req.get('exp'):
                    URI += "&exp=%d"%req.get('exp')
                if req.get('name') and req.get('sig'):
       -            sig = req.get('sig').decode('hex')
       +            sig = bfh(req.get('sig'))
                    sig = bitcoin.base_encode(sig, base=58)
                    URI += "&name=" + req['name'] + "&sig="+sig
                return str(URI)
       t@@ -876,7 +871,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                        else:
                            return
        
       -
            def save_payment_request(self):
                addr = str(self.receive_address_e.text())
                amount = self.receive_amount_e.get_amount()
       t@@ -952,7 +946,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                self.expires_combo.show()
        
            def toggle_qr_window(self):
       -        import qrwindow
       +        from . import qrwindow
                if not self.qr_window:
                    self.qr_window = qrwindow.QR_Window(self)
                    self.qr_window.setVisible(True)
       t@@ -1646,7 +1640,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                self.contact_list.update()
                self.update_completions()
        
       -
            def show_invoice(self, key):
                pr = self.invoices.get(key)
                pr.verify(self.contacts)
       t@@ -1723,8 +1716,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
        
                console.updateNamespace(methods)
        
       -
       -
            def create_status_bar(self):
        
                sb = QStatusBar()
       t@@ -1761,7 +1752,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                self.send_button.setVisible(not self.wallet.is_watching_only())
        
            def change_password_dialog(self):
       -        from password_dialog import ChangePasswordDialog
       +        from .password_dialog import ChangePasswordDialog
                d = ChangePasswordDialog(self, self.wallet)
                ok, password, new_password, encrypt_file = d.run()
                if not ok:
       t@@ -1823,9 +1814,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                if len(mpk_list) > 1:
                    def label(key):
                        if isinstance(self.wallet, Multisig_Wallet):
       -                    return _("cosigner") + ' ' + str(i+1)
       +                    return _("cosigner") + ' ' + str(key+1)
                        return ''
       -            labels = [ label(i) for i in range(len(mpk_list))]
       +            labels = [label(i) for i in range(len(mpk_list))]
                    on_click = lambda clayout: show_mpk(clayout.selected_index())
                    labels_clayout = ChoicesLayout(_("Master Public Keys"), labels, on_click)
                    vbox.addLayout(labels_clayout.layout())
       t@@ -1900,6 +1891,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                    self.show_message('Address not in wallet.')
                    return
                task = partial(self.wallet.sign_message, address, message, password)
       +
                def show_signed_message(sig):
                    signature.setText(base64.b64encode(sig).decode('ascii'))
                self.wallet.thread.add(task, on_success=show_signed_message)
       t@@ -2049,7 +2041,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                # transactions are binary, but qrcode seems to return utf8...
                data = data.decode('utf8')
                z = bitcoin.base_decode(data, length=None, base=43)
       -        data = ''.join(chr(ord(b)) for b in z).encode('hex')
       +        data = bh2u(''.join(chr(ord(b)) for b in z))
                tx = self.tx_from_text(data)
                if not tx:
                    return
       t@@ -2165,7 +2157,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
        
                self.show_message(_("Private keys exported."))
        
       -
            def do_export_privkeys(self, fileName, pklist, is_csv):
                with open(fileName, "w+") as f:
                    if is_csv:
       t@@ -2177,7 +2168,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                        import json
                        f.write(json.dumps(pklist, indent = 4))
        
       -
            def do_import_labels(self):
                labelsFile = self.getOpenFileName(_("Open labels file"), "*.json")
                if not labelsFile: return
       t@@ -2204,7 +2194,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                except (IOError, os.error) as reason:
                    self.show_critical(_("Electrum was unable to export your labels.") + "\n" + str(reason))
        
       -
            def export_history_dialog(self):
                d = WindowModalDialog(self, _('Export History'))
                d.setMinimumSize(400, 200)
       t@@ -2279,7 +2268,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                        import json
                        f.write(json.dumps(lines, indent = 4))
        
       -
            def sweep_key_dialog(self):
                d = WindowModalDialog(self, title=_('Sweep private keys'))
                d.setMinimumSize(600, 300)
   DIR diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py
       t@@ -249,19 +249,18 @@ class PayToEdit(ScanQRTextEdit):
                hasModifier = (e.modifiers() != Qt.NoModifier) and not ctrlOrShift
                completionPrefix = self.textUnderCursor()
        
       -        if hasModifier or not e.text() or completionPrefix.length() < 1 or eow.contains(e.text().right(1)):
       +        if hasModifier or not e.text() or len(completionPrefix) < 1 or eow.find(e.text()[-1]) >= 0:
                    self.c.popup().hide()
                    return
        
                if completionPrefix != self.c.completionPrefix():
       -            self.c.setCompletionPrefix(completionPrefix);
       +            self.c.setCompletionPrefix(completionPrefix)
                    self.c.popup().setCurrentIndex(self.c.completionModel().index(0, 0))
        
                cr = self.cursorRect()
                cr.setWidth(self.c.popup().sizeHintForColumn(0) + self.c.popup().verticalScrollBar().sizeHint().width())
                self.c.complete(cr)
        
       -
            def qr_input(self):
                data = super(PayToEdit,self).qr_input()
                if data.startswith("bitcoin:"):
   DIR diff --git a/gui/qt/utxo_list.py b/gui/qt/utxo_list.py
       t@@ -22,12 +22,6 @@
        # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
        # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        # SOFTWARE.
       -from __future__ import absolute_import
       -from __future__ import division
       -from __future__ import print_function
       -from __future__ import unicode_literals
       -
       -import six
        from .util import *
        from electrum.i18n import _
        from electrum.bitcoin import is_address
   DIR diff --git a/lib/coinchooser.py b/lib/coinchooser.py
       t@@ -102,7 +102,7 @@ class CoinChooserBase(PrintError):
                    value = sum(coin['value'] for coin in coins)
                    return Bucket(desc, size, value, coins)
        
       -        return map(make_Bucket, buckets.keys(), buckets.values())
       +        return list(map(make_Bucket, buckets.keys(), buckets.values()))
        
            def penalty_func(self, tx):
                def penalty(candidate):
       t@@ -128,7 +128,7 @@ class CoinChooserBase(PrintError):
                    s = str(val)
                    return len(s) - len(s.rstrip('0'))
        
       -        zeroes = map(trailing_zeroes, output_amounts)
       +        zeroes = [trailing_zeroes(i) for i in output_amounts]
                min_zeroes = min(zeroes)
                max_zeroes = max(zeroes)
                zeroes = range(max(0, min_zeroes - 1), (max_zeroes + 1) + 1)
       t@@ -137,7 +137,7 @@ class CoinChooserBase(PrintError):
                remaining = change_amount
                amounts = []
                while n > 1:
       -            average = remaining // n
       +            average = remaining / n
                    amount = self.p.randint(int(average * 0.7), int(average * 1.3))
                    precision = min(self.p.choice(zeroes), int(floor(log10(amount))))
                    amount = int(round(amount, -precision))
       t@@ -214,6 +214,9 @@ class CoinChooserBase(PrintError):
        
                return tx
        
       +    def choose_buckets(self, buckets, sufficient_funds, penalty_func):
       +        raise NotImplemented('To be subclassed')
       +
        class CoinChooserOldestFirst(CoinChooserBase):
            '''Maximize transaction priority. Select the oldest unspent
            transaction outputs in your wallet, that are sufficient to cover
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -602,8 +602,8 @@ class Commands:
                else:
                    f = None
                if f is not None:
       -            out = filter(lambda x: x.get('status')==f, out)
       -        return map(self._format_request, out)
       +            out = list(filter(lambda x: x.get('status')==f, out))
       +        return list(map(self._format_request, out))
        
            @command('w')
            def getunusedaddress(self,force=False):
   DIR diff --git a/lib/keystore.py b/lib/keystore.py
       t@@ -57,7 +57,7 @@ class KeyStore(PrintError):
                    if num_sig is None:
                        continue
                    x_signatures = txin['signatures']
       -            signatures = filter(None, x_signatures)
       +            signatures = [sig for sig in x_signatures if sig]
                    if len(signatures) == num_sig:
                        # input is complete
                        continue
       t@@ -667,7 +667,7 @@ def is_address_list(text):
        def get_private_keys(text):
            parts = text.split('\n')
            parts = map(lambda x: ''.join(x.split()), parts)
       -    parts = filter(bool, parts)
       +    parts = list(filter(bool, parts))
            if bool(parts) and all(bitcoin.is_private_key(x) for x in parts):
                return parts
        
   DIR diff --git a/lib/transaction.py b/lib/transaction.py
       t@@ -814,7 +814,7 @@ class Transaction:
                    num = txin['num_sig']
                    pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
                    for j, x_pubkey in enumerate(x_pubkeys):
       -                signatures = filter(None, txin['signatures'])
       +                signatures = list(filter(None, txin['signatures']))
                        if len(signatures) == num:
                            # txin is complete
                            break
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -1028,7 +1028,7 @@ class Abstract_Wallet(PrintError):
                    txin['signatures'] = [None] * len(txin['signatures'])
                    self.add_input_info(txin)
                # use own outputs
       -        s = filter(lambda x: self.is_mine(x[1]), outputs)
       +        s = list(filter(lambda x: self.is_mine(x[1]), outputs))
                # ... unless there is none
                if not s:
                    s = outputs