URI: 
       tfix sweeping - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 626828e98071db132595b99460858e4e8c539497
   DIR parent 4d43d12abf5413bf24b18025510c1d14e4599078
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon,  1 Oct 2018 05:16:03 +0200
       
       fix sweeping
       
       Diffstat:
         M electrum/gui/qt/main_window.py      |       2 +-
         M electrum/tests/test_wallet_vertica… |       6 +++++-
         M electrum/wallet.py                  |       2 +-
       
       3 files changed, 7 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -2583,7 +2583,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                    self.spend_max()
                    self.payto_e.setFrozen(True)
                    self.amount_e.setFrozen(True)
       -        except BaseException as e:
       +        except Exception as e:  # FIXME too broad...
                    self.show_message(str(e))
                    return
                self.warn_if_watching_only()
   DIR diff --git a/electrum/tests/test_wallet_vertical.py b/electrum/tests/test_wallet_vertical.py
       t@@ -2,6 +2,7 @@ from unittest import mock
        import shutil
        import tempfile
        from typing import Sequence
       +import asyncio
        
        from electrum import storage, bitcoin, keystore
        from electrum import Transaction
       t@@ -997,7 +998,10 @@ class TestWalletSending(TestCaseForTestnet):
                class NetworkMock:
                    relay_fee = 1000
                    def get_local_height(self): return 1325785
       -            def listunspent_for_scripthash(self, scripthash):
       +            def run_from_another_thread(self, coro):
       +                loop = asyncio.get_event_loop()
       +                return loop.run_until_complete(coro)
       +            async def listunspent_for_scripthash(self, scripthash):
                        if scripthash == '460e4fb540b657d775d84ff4955c9b13bd954c2adc26a6b998331343f85b6a45':
                            return [{'tx_hash': 'ac24de8b58e826f60bd7b9ba31670bdfc3e8aedb2f28d0e91599d741569e3429', 'tx_pos': 1, 'height': 1325785, 'value': 1000000}]
                        else:
   DIR diff --git a/electrum/wallet.py b/electrum/wallet.py
       t@@ -87,7 +87,7 @@ def append_utxos_to_inputs(inputs, network, pubkey, txin_type, imax):
                scripthash = bitcoin.script_to_scripthash(script)
                address = '(pubkey)'
        
       -    u = network.listunspent_for_scripthash(scripthash)
       +    u = network.run_from_another_thread(network.listunspent_for_scripthash(scripthash))
            for item in u:
                if len(inputs) >= imax:
                    break