From d844f75932ed184a4ce2eb7d43efa8204352767d Mon Sep 17 00:00:00 2001 From: Orbital Date: Wed, 5 Jun 2024 17:23:34 -0500 Subject: [PATCH] offers: improve offer flow logs --- src/lib.rs | 4 ++-- src/lndk_offers.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fbfe7b2b..1ee8e031 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -371,12 +371,12 @@ impl OffersMessageHandler for OfferHandler { None } OffersMessage::Invoice(invoice) => { + info!("Received an invoice: {invoice:?}"); let secp_ctx = &Secp256k1::new(); // We verify that this invoice is a response to an invoice request we sent. match invoice.verify(&self.expanded_key, secp_ctx) { Ok(payment_id) => { - info!("Received an invoice: {invoice:?}"); - + info!("Successfully verified invoice for payment_id {payment_id}"); let mut active_payments = self.active_payments.lock().unwrap(); match active_payments.get_mut(&payment_id) { Some(pay_info) => match pay_info.invoice { diff --git a/src/lndk_offers.rs b/src/lndk_offers.rs index 4dc2903d..f929b2bc 100644 --- a/src/lndk_offers.rs +++ b/src/lndk_offers.rs @@ -15,7 +15,7 @@ use lightning::offers::parse::{Bolt12ParseError, Bolt12SemanticError}; use lightning::onion_message::messenger::{Destination, PendingOnionMessage}; use lightning::onion_message::offers::OffersMessage; use lightning::sign::EntropySource; -use log::error; +use log::{debug, error}; use std::collections::hash_map::Entry; use std::error::Error; use std::fmt::Display; @@ -128,6 +128,14 @@ impl OfferHandler { let pubkey = PublicKey::from_str(&info.identity_pubkey).unwrap(); reply_path = Some(self.create_reply_path(client.clone(), pubkey).await?) }; + + if let Some(ref reply_path) = reply_path { + debug!( + "In invoice request, we chose {} as the introduction node of the reply path", + reply_path.introduction_node_id + ); + }; + let contents = OffersMessage::InvoiceRequest(invoice_request); let pending_message = PendingOnionMessage { contents, @@ -266,6 +274,11 @@ impl OfferHandler { mut payer: impl InvoicePayer + std::marker::Send + 'static, params: PayInvoiceParams, ) -> Result> { + debug!( + "Attempting to pay invoice with introduction node {}", + params.path.introduction_node_id + ); + let resp = payer .query_routes( params.path,