Browse Source
qt ChannelsList: fix opening channel with "max" amount
patch-4
SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
5 additions and
3 deletions
-
electrum/gui/qt/channels_list.py
-
electrum/gui/qt/main_window.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: |
|
|
|
|
|
@ -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) |
|
|
|