@@ -63,7 +63,7 @@ use crate::offers::merkle::SignError;
6363use crate::offers::offer::{DerivedMetadata, Offer, OfferBuilder};
6464use crate::offers::parse::Bolt12SemanticError;
6565use crate::offers::refund::{Refund, RefundBuilder};
66- use crate::onion_message::{Destination, OffersMessage, OffersMessageHandler, PendingOnionMessage};
66+ use crate::onion_message::{Destination, OffersMessage, OffersMessageHandler, PendingOnionMessage, new_pending_onion_message };
6767use crate::sign::{EntropySource, KeysManager, NodeSigner, Recipient, SignerProvider, WriteableEcdsaChannelSigner};
6868use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
6969use crate::util::wakers::{Future, Notifier};
@@ -7505,23 +7505,23 @@ where
75057505
75067506 let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
75077507 if offer.paths().is_empty() {
7508- let message = PendingOnionMessage {
7509- contents: OffersMessage::InvoiceRequest(invoice_request),
7510- destination: Destination::Node(offer.signing_pubkey()),
7511- reply_path: Some(reply_path),
7512- } ;
7508+ let message = new_pending_onion_message(
7509+ OffersMessage::InvoiceRequest(invoice_request),
7510+ Destination::Node(offer.signing_pubkey()),
7511+ Some(reply_path),
7512+ ) ;
75137513 pending_offers_messages.push(message);
75147514 } else {
75157515 // Send as many invoice requests as there are paths in the offer (with an upper bound).
75167516 // Using only one path could result in a failure if the path no longer exists. But only
75177517 // one invoice for a given payment id will be paid, even if more than one is received.
75187518 const REQUEST_LIMIT: usize = 10;
75197519 for path in offer.paths().into_iter().take(REQUEST_LIMIT) {
7520- let message = PendingOnionMessage {
7521- contents: OffersMessage::InvoiceRequest(invoice_request.clone()),
7522- destination: Destination::BlindedPath(path.clone()),
7523- reply_path: Some(reply_path.clone()),
7524- } ;
7520+ let message = new_pending_onion_message(
7521+ OffersMessage::InvoiceRequest(invoice_request.clone()),
7522+ Destination::BlindedPath(path.clone()),
7523+ Some(reply_path.clone()),
7524+ ) ;
75257525 pending_offers_messages.push(message);
75267526 }
75277527 }
@@ -7574,19 +7574,19 @@ where
75747574
75757575 let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
75767576 if refund.paths().is_empty() {
7577- let message = PendingOnionMessage {
7578- contents: OffersMessage::Invoice(invoice),
7579- destination: Destination::Node(refund.payer_id()),
7580- reply_path: Some(reply_path),
7581- } ;
7577+ let message = new_pending_onion_message(
7578+ OffersMessage::Invoice(invoice),
7579+ Destination::Node(refund.payer_id()),
7580+ Some(reply_path),
7581+ ) ;
75827582 pending_offers_messages.push(message);
75837583 } else {
75847584 for path in refund.paths() {
7585- let message = PendingOnionMessage {
7586- contents: OffersMessage::Invoice(invoice.clone()),
7587- destination: Destination::BlindedPath(path.clone()),
7588- reply_path: Some(reply_path.clone()),
7589- } ;
7585+ let message = new_pending_onion_message(
7586+ OffersMessage::Invoice(invoice.clone()),
7587+ Destination::BlindedPath(path.clone()),
7588+ Some(reply_path.clone()),
7589+ ) ;
75907590 pending_offers_messages.push(message);
75917591 }
75927592 }
0 commit comments