From beba807cfe3686df86f687a63ccd12b0db8261a5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sat, 20 Mar 2021 19:20:49 +0100 Subject: [PATCH] qt ChannelsList: fix opening channel with "max" amount --- electrum/gui/qt/channels_list.py | 4 +++- electrum/gui/qt/main_window.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py index 773b14c68..03c0cd6b6 100644 --- a/electrum/gui/qt/channels_list.py +++ b/electrum/gui/qt/channels_list.py @@ -15,6 +15,7 @@ from electrum.lnchannel import AbstractChannel, PeerState, ChannelBackup, Channe from electrum.wallet import Abstract_Wallet from electrum.lnutil import LOCAL, REMOTE, format_short_channel_id, LN_MAX_FUNDING_SAT from electrum.lnworker import LNWallet +from electrum import ecc from .util import (MyTreeView, WindowModalDialog, Buttons, OkButton, CancelButton, EnterButton, WaitingDialog, MONOSPACE_FONT, ColorScheme) @@ -414,7 +415,8 @@ class ChannelsList(MyTreeView): amount_e.setFrozen(max_button.isChecked()) if not max_button.isChecked(): return - make_tx = self.parent.mktx_for_open_channel('!') + dummy_nodeid = ecc.GENERATOR.get_public_key_bytes(compressed=True) + make_tx = self.parent.mktx_for_open_channel(funding_sat='!', node_id=dummy_nodeid) try: tx = make_tx(None) except (NotEnoughFunds, NoDynamicFeeEstimates) as e: diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 0bf8a4ab1..1d5f0fcf1 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1796,7 +1796,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): WaitingDialog(self, _('Broadcasting transaction...'), broadcast_thread, broadcast_done, self.on_error) - def mktx_for_open_channel(self, funding_sat, node_id): + def mktx_for_open_channel(self, *, funding_sat, node_id): coins = self.get_coins(nonlocal_only=True) make_tx = lambda fee_est: self.wallet.lnworker.mktx_for_open_channel( coins=coins, @@ -1813,7 +1813,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): return # use ConfirmTxDialog # we need to know the fee before we broadcast, because the txid is required - make_tx = self.mktx_for_open_channel(funding_sat, node_id) + make_tx = self.mktx_for_open_channel(funding_sat=funding_sat, node_id=node_id) d = ConfirmTxDialog(window=self, make_tx=make_tx, output_value=funding_sat, is_sweep=False) # disable preview button because the user must not broadcast tx before establishment_flow d.preview_button.setEnabled(False)