diff --git a/electrum/gui/kivy/uix/dialogs/lightning_channels.py b/electrum/gui/kivy/uix/dialogs/lightning_channels.py index aa28c95bc..01e0bcb5b 100644 --- a/electrum/gui/kivy/uix/dialogs/lightning_channels.py +++ b/electrum/gui/kivy/uix/dialogs/lightning_channels.py @@ -726,7 +726,9 @@ class SwapDialog(Factory.Popup): max_onchain_spend = 0 reverse = int(min(self.lnworker.num_sats_can_send(), self.swap_manager.get_max_amount())) - forward = int(min(self.swap_manager.num_sats_can_receive(), + max_recv_amt_ln = int(self.swap_manager.num_sats_can_receive()) + max_recv_amt_oc = self.swap_manager.get_send_amount(max_recv_amt_ln, is_reverse=False) or float('inf') + forward = int(min(max_recv_amt_oc, # maximally supported swap amount by provider self.swap_manager.get_max_amount(), max_onchain_spend)) diff --git a/electrum/gui/qt/swap_dialog.py b/electrum/gui/qt/swap_dialog.py index 45a091be2..d57c52f46 100644 --- a/electrum/gui/qt/swap_dialog.py +++ b/electrum/gui/qt/swap_dialog.py @@ -126,8 +126,9 @@ class SwapDialog(WindowModalDialog): if self.tx: amount = self.tx.output_value_for_address(ln_dummy_address()) max_swap_amt = self.swap_manager.get_max_amount() - max_recv_amt = int(self.swap_manager.num_sats_can_receive()) - max_amt = min(max_swap_amt, max_recv_amt) + max_recv_amt_ln = int(self.swap_manager.num_sats_can_receive()) + max_recv_amt_oc = self.swap_manager.get_send_amount(max_recv_amt_ln, is_reverse=False) or float('inf') + max_amt = int(min(max_swap_amt, max_recv_amt_oc)) if amount > max_amt: amount = max_amt self._update_tx(amount)