@@ -63,7 +63,7 @@ use crate::offers::merkle::SignError;
63
63
use crate::offers::offer::{DerivedMetadata, Offer, OfferBuilder};
64
64
use crate::offers::parse::Bolt12SemanticError;
65
65
use 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 };
67
67
use crate::sign::{EntropySource, KeysManager, NodeSigner, Recipient, SignerProvider, WriteableEcdsaChannelSigner};
68
68
use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
69
69
use crate::util::wakers::{Future, Notifier};
@@ -7505,23 +7505,23 @@ where
7505
7505
7506
7506
let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
7507
7507
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
+ ) ;
7513
7513
pending_offers_messages.push(message);
7514
7514
} else {
7515
7515
// Send as many invoice requests as there are paths in the offer (with an upper bound).
7516
7516
// Using only one path could result in a failure if the path no longer exists. But only
7517
7517
// one invoice for a given payment id will be paid, even if more than one is received.
7518
7518
const REQUEST_LIMIT: usize = 10;
7519
7519
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
+ ) ;
7525
7525
pending_offers_messages.push(message);
7526
7526
}
7527
7527
}
@@ -7574,19 +7574,19 @@ where
7574
7574
7575
7575
let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
7576
7576
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
+ ) ;
7582
7582
pending_offers_messages.push(message);
7583
7583
} else {
7584
7584
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
+ ) ;
7590
7590
pending_offers_messages.push(message);
7591
7591
}
7592
7592
}
0 commit comments