- let status = match invoice_payer.pay_invoice(invoice) {
- Ok(_payment_id) => {
- let payee_pubkey = invoice.recover_payee_pub_key();
- let amt_msat = invoice.amount_milli_satoshis().unwrap();
- println!("EVENT: initiated sending {} msats to {}", amt_msat, payee_pubkey);
- print!("> ");
- HTLCStatus::Pending
- }
- Err(PaymentError::Invoice(e)) => {
- println!("ERROR: invalid invoice: {}", e);
- print!("> ");
- return;
- }
- Err(PaymentError::Routing(e)) => {
- println!("ERROR: failed to find route: {}", e.err);
- print!("> ");
- return;
- }
- Err(PaymentError::Sending(e)) => {
- println!("ERROR: failed to send payment: {:?}", e);
- print!("> ");
- HTLCStatus::Failed
- }
- };
- let payment_hash = PaymentHash(invoice.payment_hash().clone().into_inner());
- let payment_secret = Some(invoice.payment_secret().clone());
-
- let mut payments = payment_storage.lock().unwrap();
- payments.insert(
- payment_hash,
+ let payment_id = PaymentId((*invoice.payment_hash()).to_byte_array());
+ let payment_hash = PaymentHash((*invoice.payment_hash()).to_byte_array());
+ let payment_secret = Some(*invoice.payment_secret());
+ outbound_payments.payments.insert(
+ payment_id,