From bd12d5222a0b3b0bb553224e99c5b270e630f017 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu <84944042+niteshbalusu11@users.noreply.github.com> Date: Fri, 24 Nov 2023 08:27:56 +0530 Subject: [PATCH] reject inbound legacy channels by default Signed-off-by: Nitesh Balusu <84944042+niteshbalusu11@users.noreply.github.com> --- src/state/ChannelAcceptanceManager.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/state/ChannelAcceptanceManager.ts b/src/state/ChannelAcceptanceManager.ts index 0e4087177..e1af2548d 100644 --- a/src/state/ChannelAcceptanceManager.ts +++ b/src/state/ChannelAcceptanceManager.ts @@ -7,6 +7,7 @@ import { bytesToHexString } from "../utils"; import logger from "./../utils/log"; import { IStoreModel } from "./index"; import { checkLndStreamErrorResponse } from "../utils/lndmobile"; +import { lnrpc } from "../../proto/lightning"; const log = logger("ChannelAcceptanceManager"); @@ -34,6 +35,20 @@ export const channelAcceptanceManager: IChannelAcceptanceManagerModel = { log.i("Channel accept request", [channelAcceptRequest]); + // Reject unknown, legacy and static remote key channels + + if ( + channelAcceptRequest.commitmentType === lnrpc.CommitmentType.LEGACY || + channelAcceptRequest.commitmentType === lnrpc.CommitmentType.STATIC_REMOTE_KEY || + channelAcceptRequest.commitmentType === lnrpc.CommitmentType.UNKNOWN_COMMITMENT_TYPE + ) { + await injections.lndMobile.channel.channelAcceptorResponse( + channelAcceptRequest.pendingChanId, + false, + ); + return; + } + if (!!channelAcceptRequest.wantsZeroConf) { const zeroConfPeers = getStoreState().settings.zeroConfPeers;