From 31cee498628468ee302924828707433113a85e86 Mon Sep 17 00:00:00 2001 From: Parham Saremi Date: Mon, 7 Nov 2022 17:22:28 +0330 Subject: [PATCH] Frontend.Console: ask confirmation from funder Previously we only asked the funder to press a key to continue the process. But now we ask the funder to state if he wants to continue or not. --- src/GWallet.Frontend.Console/LayerTwo.fs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/GWallet.Frontend.Console/LayerTwo.fs b/src/GWallet.Frontend.Console/LayerTwo.fs index 3405cd153..fe75a8706 100644 --- a/src/GWallet.Frontend.Console/LayerTwo.fs +++ b/src/GWallet.Frontend.Console/LayerTwo.fs @@ -561,10 +561,6 @@ module LayerTwo = Console.WriteLine "In order to continue the funding for the channel needs to be locked" let lockFundingAsync = if channelInfo.IsFunder then - Console.WriteLine - "Ensure the fundee is ready to accept a connection to lock the funding, \ - then press any key to continue." - Console.ReadKey true |> ignore let tryLock password = async { let nodeClient = Lightning.Connection.StartClient channelStore password @@ -573,7 +569,19 @@ module LayerTwo = return! lockChannelInternal (Node.Client nodeClient) sublockFundingAsync } - UserInteraction.TryWithPasswordAsync tryLock + let confirmation = + UserInteraction.AskYesNo + "Ensure the fundee is ready to accept a connection to lock the funding, \ + Do you want to continue?" + if not confirmation then + async { + return seq { + yield! UserInteraction.DisplayLightningChannelStatus channelInfo + yield " funder didn't confirm to lock the funding!" + } + } + else + UserInteraction.TryWithPasswordAsync tryLock else let nodeServerType = match channelInfo.NodeTransportType with