+ while user_provided_amt.is_none() {
+ print!("Paying offer for {} msat. Continue (Y/N)? >", amt_msat);
+ io::stdout().flush().unwrap();
+
+ if let Err(e) = io::stdin().read_line(&mut line) {
+ println!("ERROR: {}", e);
+ break 'read_command;
+ }
+
+ if line.len() == 0 {
+ // We hit EOF / Ctrl-D
+ break 'read_command;
+ }
+
+ if line.starts_with("Y") {
+ break;
+ }
+ if line.starts_with("N") {
+ continue 'read_command;
+ }
+ }
+
+ outbound_payments.lock().unwrap().payments.insert(
+ payment_id,
+ PaymentInfo {
+ preimage: None,
+ secret: None,
+ status: HTLCStatus::Pending,
+ amt_msat: MillisatAmount(Some(amt_msat)),
+ },
+ );
+ fs_store
+ .write("", "", OUTBOUND_PAYMENTS_FNAME, &outbound_payments.encode())
+ .unwrap();
+
+ let retry = Retry::Timeout(Duration::from_secs(10));
+ let amt = Some(amt_msat);
+ let pay = channel_manager
+ .pay_for_offer(&offer, None, amt, None, payment_id, retry, None);
+ if pay.is_err() {
+ println!("ERROR: Failed to pay: {:?}", pay);
+ }
+ } else {
+ match Bolt11Invoice::from_str(invoice_str.unwrap()) {
+ Ok(invoice) => send_payment(
+ &channel_manager,
+ &invoice,
+ user_provided_amt,
+ &mut outbound_payments.lock().unwrap(),
+ Arc::clone(&fs_store),
+ ),
+ Err(e) => {
+ println!("ERROR: invalid invoice: {:?}", e);
+ }
+ }
+ }