1
0

coins tab: if we do not know whether we can swap a utxo, assume we can

This commit is contained in:
ThomasV
2024-12-17 17:43:43 +01:00
parent 77ec49ac67
commit 692a777da8
2 changed files with 5 additions and 0 deletions

View File

@@ -238,6 +238,9 @@ class UTXOList(MyTreeView):
value = sum(x.value_sats() for x in coins)
min_amount = self.wallet.lnworker.swap_manager.get_min_amount()
max_amount = self.wallet.lnworker.swap_manager.max_amount_forward_swap()
if min_amount is None or max_amount is None:
# we need to fetch data from swap server
return True
if value < min_amount:
return False
if max_amount is None or value > max_amount:

View File

@@ -1121,6 +1121,8 @@ class SwapManager(Logger):
def max_amount_forward_swap(self) -> Optional[int]:
""" returns None if we cannot swap """
max_swap_amt_ln = self.get_max_amount()
if max_swap_amt_ln is None:
return None
max_recv_amt_ln = int(self.lnworker.num_sats_can_receive())
max_amt_ln = int(min(max_swap_amt_ln, max_recv_amt_ln))
max_amt_oc = self.get_send_amount(max_amt_ln, is_reverse=False) or 0