URI: 
       ttest funding_txn_minimum_depth, show it in GUI - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 9f8e2c689e0cc5b5144eda383d0c33dd2f85e1f1
   DIR parent bbec1dceda76201763d4bfdc33e01db3002f06da
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Mon, 12 Aug 2019 17:54:27 +0200
       
       ttest funding_txn_minimum_depth, show it in GUI
       
       Diffstat:
         M electrum/commands.py                |       3 ++-
         M electrum/gui/kivy/uix/dialogs/ligh… |      10 ++++++++--
         M electrum/gui/qt/main_window.py      |      12 +++++++-----
         M electrum/lnpeer.py                  |       5 ++++-
         M electrum/lnworker.py                |       2 +-
       
       5 files changed, 22 insertions(+), 10 deletions(-)
       ---
   DIR diff --git a/electrum/commands.py b/electrum/commands.py
       t@@ -782,7 +782,8 @@ class Commands:
        
            @command('wpn')
            def open_channel(self, connection_string, amount, channel_push=0, password=None):
       -        return self.lnworker.open_channel(connection_string, satoshis(amount), satoshis(channel_push), password)
       +        chan = self.lnworker.open_channel(connection_string, satoshis(amount), satoshis(channel_push), password)
       +        return chan.funding_outpoint.to_str()
        
            @command('wn')
            def lnpay(self, invoice, attempts=1, timeout=10):
   DIR diff --git a/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py b/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py
       t@@ -136,8 +136,14 @@ class LightningOpenChannelDialog(Factory.Popup):
        
            def do_open_channel(self, conn_str, amount, password):
                try:
       -            node_id_hex = self.app.wallet.lnworker.open_channel(conn_str, amount, 0, password=password)
       +            chan = self.app.wallet.lnworker.open_channel(conn_str, amount, 0, password=password)
                except Exception as e:
                    self.app.show_error(_('Problem opening channel: ') + '\n' + repr(e))
                    return
       -        self.app.show_info(_('Please wait for confirmation, channel is opening with node ') + node_id_hex[:16])
       +        n = chan.constraints.funding_txn_minimum_depth
       +        message = '\n'.join([
       +            _('Channel established.'),
       +            _('Remote peer ID') + ':' + chan.node_id.hex(),
       +            _('This channel will be usable after {} confirmations').format(n)
       +        ])
       +        self.app.show_info(message)
   DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -1839,12 +1839,14 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
            def open_channel(self, *args, **kwargs):
                def task():
                    return self.wallet.lnworker.open_channel(*args, **kwargs)
       -        def on_success(node_id):
       -            self.show_message('\n'.join([
       +        def on_success(chan):
       +            n = chan.constraints.funding_txn_minimum_depth
       +            message = '\n'.join([
                        _('Channel established.'),
       -                _('Remote peer ID') + ':' + node_id,
       -                _('This channel will be usable after 3 confirmations')
       -            ]))
       +                _('Remote peer ID') + ':' + chan.node_id.hex(),
       +                _('This channel will be usable after {} confirmations').format(n)
       +            ])
       +            self.show_message(message)
                def on_failure(exc_info):
                    type_, e, traceback = exc_info
                    self.show_error(_('Could not open channel: {}').format(e))
   DIR diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py
       t@@ -498,7 +498,10 @@ class Peer(Logger):
                    raise Exception('Remote Lightning peer reported error: ' + repr(payload.get('error')))
                remote_per_commitment_point = payload['first_per_commitment_point']
                funding_txn_minimum_depth = int.from_bytes(payload['minimum_depth'], 'big')
       -        assert funding_txn_minimum_depth > 0, funding_txn_minimum_depth
       +        if funding_txn_minimum_depth <= 0:
       +            raise Exception(f"minimum depth too low, {funding_txn_minimum_depth}")
       +        if funding_txn_minimum_depth > 30:
       +            raise Exception(f"minimum depth too high, {funding_txn_minimum_depth}")
                remote_dust_limit_sat = int.from_bytes(payload['dust_limit_satoshis'], byteorder='big')
                remote_reserve_sat = self.validate_remote_reserve(payload["channel_reserve_satoshis"], remote_dust_limit_sat, funding_sat)
                if remote_dust_limit_sat > remote_reserve_sat:
   DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py
       t@@ -717,7 +717,7 @@ class LNWallet(LNWorker):
                    chan = fut.result(timeout=timeout)
                except concurrent.futures.TimeoutError:
                    raise Exception(_("open_channel timed out"))
       -        return chan.funding_outpoint.to_str()
       +        return chan
        
            def pay(self, invoice, attempts=1, amount_sat=None, timeout=10):
                """