loop/cmd
Slyghtning 3c495a2a5c
cmd/loop: require explicit 'y' confirmation on reservation new
The reservation new command printed the prepay cost and asked the user
to confirm with 'y/n'. The implementation read the answer with
fmt.Scanln(&answer) and treated only the literal 'n' as a 'no'. The
return value was discarded, so:

  - On EOF / closed stdin (CI pipelines, automated wrappers, terminal
    disconnect) Scanln returned an error and answer remained the empty
    string, which is not 'n', so the command proceeded and paid the
    LN prepayment with no user confirmation.
  - The case-sensitive 'n' check also accepted 'N', 'no', 'yes', 'Y',
    or any other string as a 'yes'.

Match the convention used by the rest of the loop CLI: only continue
when the user typed exactly 'y' (or 'Y'), and treat any read error as
'no'.
2026-08-11 15:02:42 +02:00
..
loop cmd/loop: require explicit 'y' confirmation on reservation new 2026-08-11 15:02:42 +02:00
loopd cmd/loop: set exit code 1 on error 2020-06-11 21:00:24 +02:00