From 1101a26552c5a901742d6e42efd24a8eef7b79fe Mon Sep 17 00:00:00 2001 From: Ivan Vershigora Date: Thu, 14 Nov 2024 12:37:14 +0000 Subject: [PATCH] fix: calculations in ReceiveConnect --- src/screens/Wallets/Receive/ReceiveConnect.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/screens/Wallets/Receive/ReceiveConnect.tsx b/src/screens/Wallets/Receive/ReceiveConnect.tsx index 7a06a3bfa..0bb7b5ac0 100644 --- a/src/screens/Wallets/Receive/ReceiveConnect.tsx +++ b/src/screens/Wallets/Receive/ReceiveConnect.tsx @@ -41,7 +41,7 @@ const ReceiveConnect = ({ const { maxChannelSizeSat } = blocktank.options; const minChannelSize = Math.round(amount * 2.5); const maxChannelSize = Math.round(maxChannelSizeSat / 2); - const channelSize = Math.max(minChannelSize, maxChannelSize); + const channelSize = Math.min(minChannelSize, maxChannelSize); const lspBalance = channelSize - amount; const payAmount = amount - feeEstimate; const displayFee = useDisplayValues(feeEstimate); @@ -76,7 +76,7 @@ const ReceiveConnect = ({ const onContinue = async (): Promise => { setIsLoading(true); const cJitEntryResponse = await createCJitEntry({ - channelSize: channelSize, + channelSize, invoiceAmount: amount, invoiceDescription: message, }); @@ -86,6 +86,7 @@ const ReceiveConnect = ({ title: t('receive_cjit_error'), description: cJitEntryResponse.error.message, }); + setIsLoading(false); return; } const order = cJitEntryResponse.value;