handle channel reserve error

This commit is contained in:
Paul Miller
2023-11-27 16:40:13 -06:00
committed by Tony Giorgio
parent d17dbb0210
commit daf57b84bf
3 changed files with 18 additions and 6 deletions

View File

@@ -121,6 +121,9 @@ export default {
"We do not have enough balance to pay the given amount.",
error_invoice_match:
"Amount requested, {{amount}} SATS, does not equal amount set.",
error_channel_reserves: "Not enough available funds.",
error_channel_reserves_explained:
"A portion of your channel balance is reserved for fees. Try sending a smaller amount or adding funds.",
error_clipboard: "Clipboard not supported",
error_keysend: "Keysend failed",
error_LNURL: "LNURL Pay failed",
@@ -310,7 +313,7 @@ export default {
inbound_outbound_tip:
"Outbound is the amount of money you can spend on lightning. Inbound is the amount you can receive without incurring a lightning service fee.",
reserve_tip:
"About 1% of your channel balance is reserved on lightning for fees.",
"About 1% of your channel balance is reserved on lightning for fees. Additional reserves are required for channels you opened via swap.",
no_channels:
"It looks like you don't have any channels yet. To get started, receive some sats over lightning, or swap some on-chain funds into a channel. Get your hands dirty!"
},

View File

@@ -1,7 +1,7 @@
import { Clipboard } from "@capacitor/clipboard";
import { Capacitor } from "@capacitor/core";
import { Contact, MutinyInvoice, TagItem } from "@mutinywallet/mutiny-wasm";
import { useNavigate } from "@solidjs/router";
import { A, useNavigate } from "@solidjs/router";
import {
createEffect,
createMemo,
@@ -227,6 +227,18 @@ function Failure(props: { reason: string }) {
{i18n.t("send.payment_pending_description")}
</InfoBox>
</Match>
<Match
when={props.reason === "Channel reserve amount is too high."}
>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.error_channel_reserves")}
</h1>
<InfoBox accent="white">
{i18n.t("send.error_channel_reserves_explained")}{" "}
<A href="/settings/channels">{i18n.t("common.why")}</A>
</InfoBox>
</Match>
<Match when={true}>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">

View File

@@ -74,10 +74,7 @@ export function LiquidityMonitor() {
let reserve = 0n;
for (const channel of channels) {
inbound =
inbound +
BigInt(channel.size) -
BigInt(channel.balance + channel.reserve);
inbound = inbound + BigInt(channel.inbound);
reserve = reserve + BigInt(channel.reserve);
outbound = outbound + BigInt(channel.balance);
}