URI: 
       tsubmarine swaps: add normal swaps to GUI, various minor fixes - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 7d2979d776d324f7e7d061c8c4b361f74c96dcb5
   DIR parent eb9f6ce2935bf9fbdf9f9301ccd09b83e95c51b8
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sat, 23 May 2020 12:28:49 +0200
       
       submarine swaps: add normal swaps to GUI, various minor fixes
       
       Diffstat:
         M electrum/gui/qt/swap_dialog.py      |       8 +++++---
         M electrum/submarine_swaps.py         |       7 ++++++-
       
       2 files changed, 11 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/swap_dialog.py b/electrum/gui/qt/swap_dialog.py
       t@@ -123,9 +123,11 @@ class SwapDialog(WindowModalDialog):
                self.get_pairs()
                if not self.exec_():
                    return
       -        amount_sat = self.send_amount_e.get_amount()
                if self.is_reverse:
       +            amount_sat = self.send_amount_e.get_amount()
                    coro = ss.reverse_swap(amount_sat, self.window.wallet, self.network)
       -            asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)
                else:
       -            pass
       +            amount_sat = self.recv_amount_e.get_amount()
       +            password = self.window.protect(lambda x: x, [])
       +            coro = ss.normal_swap(amount_sat, self.window.wallet, self.network, password)
       +        asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)
   DIR diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py
       t@@ -9,7 +9,11 @@ from .transaction import script_GetOp, match_script_against_template, OPPushData
        from .transaction import Transaction
        from .util import log_exceptions
        from .bitcoin import dust_threshold
       +from typing import TYPE_CHECKING
        
       +if TYPE_CHECKING:
       +    from .network import Network
       +    from .wallet import Abstract_Wallet
        
        API_URL = 'http://ecdsa.org:9001'
        
       t@@ -132,6 +136,7 @@ async def normal_swap(amount_sat, wallet: 'Abstract_Wallet', network: 'Network',
            lnaddr = lnworker._check_invoice(invoice, amount_sat)
            payment_hash = lnaddr.paymenthash
            preimage = lnworker.get_preimage(payment_hash)
       +    address = wallet.get_unused_address()
            request_data = {
                "type": "submarine",
                "pairId": "BTC/BTC",
       t@@ -148,7 +153,7 @@ async def normal_swap(amount_sat, wallet: 'Abstract_Wallet', network: 'Network',
            response_id = data["id"]
            zeroconf = data["acceptZeroConf"]
            onchain_amount = data["expectedAmount"]
       -    locktime = data["timeoutBlockHeight"],
       +    locktime = data["timeoutBlockHeight"]
            lockup_address = data["address"]
            redeem_script = data["redeemScript"]
            # verify redeem_script is built with our pubkey and preimage