Skip to content

Commit

Permalink
Frontend.Console: ask confirmation from funder
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
parhamsaremi committed Nov 22, 2022
1 parent 6b72502 commit 7484570
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/GWallet.Frontend.Console/LayerTwo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7484570

Please sign in to comment.