diff --git a/ios/LndMobile/Lnd.swift b/ios/LndMobile/Lnd.swift
index f9f74927..62b51ceb 100644
--- a/ios/LndMobile/Lnd.swift
+++ b/ios/LndMobile/Lnd.swift
@@ -123,6 +123,7 @@ open class Lnd {
"SignMessage": { bytes, cb in LndmobileSignMessage(bytes, cb) },
"SignerSignMessage": { bytes, cb in LndmobileSignerSignMessage(bytes, cb) },
"RestoreChannelBackups": { bytes, cb in LndmobileRestoreChannelBackups(bytes, cb) },
+ "WalletKitListSweeps": { bytes, cb in LndmobileWalletKitListSweeps(bytes, cb) },
// autopilot
"AutopilotStatus": { bytes, cb in LndmobileAutopilotStatus(bytes, cb) },
diff --git a/src/components/PendingChannelCard.tsx b/src/components/PendingChannelCard.tsx
index 99dd3d13..420c2344 100644
--- a/src/components/PendingChannelCard.tsx
+++ b/src/components/PendingChannelCard.tsx
@@ -5,7 +5,7 @@ import Long from "long";
import BigNumber from "bignumber.js";
import { style } from "./ChannelCard";
-import { lnrpc } from "../../proto/lightning";
+import { lnrpc, walletrpc } from "../../proto/lightning";
import { blixtTheme } from "../native-base-theme/variables/commonColor";
import { useStoreActions, useStoreState } from "../state/store";
import { identifyService, lightningServices } from "../utils/lightning-services";
@@ -16,6 +16,7 @@ import { getUnitNice, valueBitcoin, valueFiat } from "../utils/bitcoin-units";
import { useTranslation } from "react-i18next";
import { namespaces } from "../i18n/i18n.constants";
import { Alert } from "../utils/alert";
+import { pendingSweeps } from "../lndmobile/wallet";
const dataLossChannelState = "ChanStatusLocalDataLoss|ChanStatusRestored";
@@ -98,6 +99,54 @@ export const PendingChannelCard = ({ channel, type, alias }: IPendingChannelCard
);
};
+ const dragForceCloseAnchor = async (
+ channel: lnrpc.PendingChannelsResponse.IWaitingCloseChannel,
+ ) => {
+ Alert.prompt(t("channel.bumpFee"), t("channel.bumpFeeAlerts.enterFeeRate"), [
+ {
+ text: t("buttons.cancel", { ns: namespaces.common }),
+ style: "cancel",
+ onPress: () => {},
+ },
+ {
+ text: "OK",
+ onPress: async (feeRate) => {
+ if (!feeRate) {
+ Alert.alert(t("channel.bumpFeeAlerts.missingFeeRate"));
+ return;
+ }
+
+ const feeRateNumber = Number.parseInt(feeRate);
+
+ // Follows anchor sweep code in bumpForceCloseFee.go in lnd/cmd/lncli/walletrpc_active.go
+
+ //& Fetch waiting close channel commitments.
+ const sweeps = await pendingSweeps();
+
+ //& Retrieve pending sweeps.
+ const commitments = [channel.commitments?.localTxid, channel.commitments?.remoteTxid];
+
+ //& Match pending sweeps with commitments of the channel for which a bump
+ //& is requested and bump their fees.
+ for (const sweep of sweeps.pendingSweeps) {
+ //& Only bump anchor sweeps.
+ if (sweep.witnessType !== walletrpc.WitnessType.COMMITMENT_ANCHOR) {
+ continue;
+ }
+
+ if (commitments.includes(sweep.outpoint?.txidStr)) {
+ await bumpFee({
+ txid: sweep.outpoint?.txidStr ?? "",
+ index: sweep.outpoint?.outputIndex ?? 0,
+ feeRate: feeRateNumber,
+ });
+ }
+ }
+ },
+ },
+ ]);
+ };
+
const bumpChannelFee = async (channel: lnrpc.PendingChannelsResponse.IPendingOpenChannel) => {
if (!channel.channel || !channel.channel.channelPoint) {
Alert.alert(t("msg.error", { ns: namespaces.common }));
@@ -391,6 +440,18 @@ export const PendingChannelCard = ({ channel, type, alias }: IPendingChannelCard
)}
+
+
+
+
+
>
)}
{type === "FORCE_CLOSING" && (
diff --git a/src/lndmobile/wallet.ts b/src/lndmobile/wallet.ts
index 8e701c0f..aec8f673 100644
--- a/src/lndmobile/wallet.ts
+++ b/src/lndmobile/wallet.ts
@@ -2,7 +2,7 @@ import * as base64 from "base64-js";
import { sendCommand, sendStreamCommand, decodeStreamResult } from "./utils";
import { stringToUint8Array } from "../utils";
-import { lnrpc, signrpc } from "../../proto/lightning";
+import { lnrpc, signrpc, walletrpc } from "../../proto/lightning";
/**
* @throws
@@ -224,6 +224,23 @@ export const restoreChannelBackups = async (
return response;
};
+/**
+ * @throws
+ */
+export const pendingSweeps = async (): Promise => {
+ const response = await sendCommand<
+ walletrpc.IPendingSweepsRequest,
+ walletrpc.PendingSweepsRequest,
+ walletrpc.PendingSweepsResponse
+ >({
+ request: walletrpc.PendingSweepsRequest,
+ response: walletrpc.PendingSweepsResponse,
+ method: "WalletKitPendingSweeps",
+ options: {},
+ });
+ return response;
+};
+
// TODO exception?
// TODO move to a more appropriate file?
export const subscribeInvoices = async (): Promise => {
diff --git a/src/windows/InitProcess/DEV_Commands.tsx b/src/windows/InitProcess/DEV_Commands.tsx
index 83b82591..f653f031 100644
--- a/src/windows/InitProcess/DEV_Commands.tsx
+++ b/src/windows/InitProcess/DEV_Commands.tsx
@@ -47,7 +47,7 @@ import {
getTransaction,
getTransactions,
} from "../../storage/database/transaction";
-import { genSeed, initWallet, signMessage } from "../../lndmobile/wallet";
+import { genSeed, initWallet, pendingSweeps, signMessage } from "../../lndmobile/wallet";
import { getPin, getWalletPassword } from "../../storage/keystore";
import { lnrpc, routerrpc } from "../../../proto/lightning";
import { modifyStatus, queryScores, status } from "../../lndmobile/autopilot";
@@ -72,6 +72,7 @@ import { blixtTheme } from "../../native-base-theme/variables/commonColor";
import { generateSecureRandom } from "../../lndmobile/index";
import { localNotification } from "../../utils/push-notification";
import { sendCommand } from "../../lndmobile/utils";
+import { getCFilter } from "../../lndmobile/neutrino";
let iCloudStorage: any;
console.log(PLATFORM);
@@ -196,6 +197,17 @@ export default function DEV_Commands({ navigation, continueCallback }: IProps) {
>
set bricked true
+