Skip to content

Commit fa6f20d

Browse files
committed
f - rename send_response_static_invoice_request and handle invoice om
1 parent 0a029b5 commit fa6f20d

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

lightning/src/events/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,9 +1658,9 @@ pub enum Event {
16581658
/// The path to where invoice requests will be forwarded. If we receive an invoice
16591659
/// request, we'll forward it to the async recipient over this path in case the
16601660
/// recipient is online to provide a new invoice. This path should be persisted and
1661-
/// later provided to [`ChannelManager::send_response_static_invoice_request`].
1661+
/// later provided to [`ChannelManager::respond_to_static_invoice_request`].
16621662
///
1663-
/// [`ChannelManager::send_response_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::send_response_static_invoice_request
1663+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
16641664
invoice_request_path: BlindedMessagePath,
16651665
/// Useful for the recipient to replace a specific invoice stored by us as the static invoice
16661666
/// server.
@@ -1694,14 +1694,14 @@ pub enum Event {
16941694
///
16951695
/// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that
16961696
/// matches the below `recipient_id` and `invoice_slot`, that invoice should be retrieved now
1697-
/// and forwarded to the payer via [`ChannelManager::send_response_static_invoice_request`].
1697+
/// and forwarded to the payer via [`ChannelManager::respond_to_static_invoice_request`].
16981698
/// The invoice request path previously persisted from [`Event::PersistStaticInvoice`] should
1699-
/// also be provided in [`ChannelManager::send_response_static_invoice_request`].
1699+
/// also be provided in [`ChannelManager::respond_to_static_invoice_request`].
17001700
///
17011701
/// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
17021702
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
17031703
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1704-
/// [`ChannelManager::send_response_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::send_response_static_invoice_request
1704+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
17051705
StaticInvoiceRequested {
17061706
/// An identifier for the recipient previously surfaced in
17071707
/// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_slot` to
@@ -1712,15 +1712,15 @@ pub enum Event {
17121712
/// retrieve the [`StaticInvoice`] requested by the payer.
17131713
invoice_slot: u16,
17141714
/// The path over which the [`StaticInvoice`] will be sent to the payer, which should be
1715-
/// provided to [`ChannelManager::send_response_static_invoice_request`] along with the invoice.
1715+
/// provided to [`ChannelManager::respond_to_static_invoice_request`] along with the invoice.
17161716
///
1717-
/// [`ChannelManager::send_response_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::send_response_static_invoice_request
1717+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
17181718
reply_path: Responder,
17191719
/// The invoice request that will be forwarded to the async recipient to give the
17201720
/// recipient a chance to provide an invoice in case it is online. It should be
1721-
/// provided to [`ChannelManager::send_response_static_invoice_request`].
1721+
/// provided to [`ChannelManager::respond_to_static_invoice_request`].
17221722
///
1723-
/// [`ChannelManager::send_response_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::send_response_static_invoice_request
1723+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
17241724
invoice_request: InvoiceRequest,
17251725
},
17261726
/// Indicates that a channel funding transaction constructed interactively is ready to be

lightning/src/ln/async_payments_tests.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ fn pass_async_payments_oms(
223223

224224
always_online_recipient_counterparty
225225
.node
226-
.send_response_static_invoice_request(
226+
.respond_to_static_invoice_request(
227227
static_invoice,
228228
reply_path,
229229
invoice_request,
@@ -604,7 +604,7 @@ fn ignore_unexpected_static_invoice() {
604604
// Check that the sender will ignore the unexpected static invoice.
605605
nodes[1]
606606
.node
607-
.send_response_static_invoice_request(
607+
.respond_to_static_invoice_request(
608608
unexpected_static_invoice,
609609
reply_path.clone(),
610610
invoice_request.clone(),
@@ -626,7 +626,7 @@ fn ignore_unexpected_static_invoice() {
626626
// held_htlc_available onion message.
627627
nodes[1]
628628
.node
629-
.send_response_static_invoice_request(
629+
.respond_to_static_invoice_request(
630630
valid_static_invoice.clone(),
631631
reply_path.clone(),
632632
invoice_request.clone(),
@@ -649,7 +649,7 @@ fn ignore_unexpected_static_invoice() {
649649
// Receiving a duplicate invoice will have no effect.
650650
nodes[1]
651651
.node
652-
.send_response_static_invoice_request(
652+
.respond_to_static_invoice_request(
653653
valid_static_invoice,
654654
reply_path,
655655
invoice_request,
@@ -738,15 +738,15 @@ fn ignore_duplicate_invoice() {
738738

739739
always_online_node
740740
.node
741-
.send_response_static_invoice_request(
741+
.respond_to_static_invoice_request(
742742
static_invoice.clone(),
743743
reply_path,
744744
invoice_request,
745745
invoice_flow_res.invoice_request_path.clone(),
746746
)
747747
.unwrap();
748748

749-
// After calling `send_response_static_invoice_request` the next two messages should be the
749+
// After calling `respond_to_static_invoice_request` the next two messages should be the
750750
// invoice request to the intended for the async recipient and the static invoice to the
751751
// payer.
752752
let invreq_om =
@@ -835,7 +835,7 @@ fn ignore_duplicate_invoice() {
835835

836836
always_online_node
837837
.node
838-
.send_response_static_invoice_request(
838+
.respond_to_static_invoice_request(
839839
static_invoice.clone(),
840840
reply_path,
841841
invoice_request,
@@ -857,15 +857,12 @@ fn ignore_duplicate_invoice() {
857857
let invoice_om =
858858
async_recipient.onion_messenger.next_onion_message_for_peer(sender_node_id).unwrap();
859859

860-
let (invoice, context) = match sender.onion_messenger.peel_onion_message(&invoice_om) {
861-
Ok(PeeledOnion::Offers(OffersMessage::Invoice(invoice), context, _)) => (invoice, context),
860+
let invoice = match sender.onion_messenger.peel_onion_message(&invoice_om) {
861+
Ok(PeeledOnion::Offers(OffersMessage::Invoice(invoice), _, _)) => invoice,
862862
_ => panic!(),
863863
};
864864

865-
assert!(matches!(
866-
sender.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()),
867-
Ok(())
868-
));
865+
sender.onion_messenger.handle_onion_message(async_recipient_id, &invoice_om);
869866

870867
let mut events = sender.node.get_and_clear_pending_msg_events();
871868
assert_eq!(events.len(), 1);
@@ -1008,7 +1005,7 @@ fn expired_static_invoice_fail() {
10081005

10091006
nodes[1]
10101007
.node
1011-
.send_response_static_invoice_request(
1008+
.respond_to_static_invoice_request(
10121009
static_invoice.clone(),
10131010
reply_path,
10141011
invoice_request,
@@ -1093,7 +1090,7 @@ fn timeout_unreleased_payment() {
10931090

10941091
server
10951092
.node
1096-
.send_response_static_invoice_request(
1093+
.respond_to_static_invoice_request(
10971094
static_invoice.clone(),
10981095
reply_path,
10991096
invoice_request,
@@ -2617,7 +2614,7 @@ fn invoice_request_forwarded_to_async_recipient() {
26172614

26182615
always_online_node
26192616
.node
2620-
.send_response_static_invoice_request(
2617+
.respond_to_static_invoice_request(
26212618
static_invoice,
26222619
reply_path,
26232620
invoice_request,

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5296,7 +5296,7 @@ where
52965296
/// [`Event::StaticInvoiceRequested`]. Also forwards the payer's [`InvoiceRequest`] to the
52975297
/// async recipient, in case the recipient is online to provide the payer with a fresh
52985298
/// [`Bolt12Invoice`].
5299-
pub fn send_response_static_invoice_request(
5299+
pub fn respond_to_static_invoice_request(
53005300
&self, invoice: StaticInvoice, responder: Responder, invoice_request: InvoiceRequest,
53015301
invoice_request_path: BlindedMessagePath,
53025302
) -> Result<(), Bolt12SemanticError> {

lightning/src/offers/flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,13 +1132,13 @@ where
11321132
/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath
11331133
/// [`Responder`]: crate::onion_message::messenger::Responder
11341134
pub fn enqueue_invoice_request_to_forward(
1135-
&self, invoice_request: InvoiceRequest, invoice_request_path: BlindedMessagePath,
1135+
&self, invoice_request: InvoiceRequest, destination: BlindedMessagePath,
11361136
reply_path: Responder,
11371137
) {
11381138
let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
11391139
let message = OffersMessage::InvoiceRequest(invoice_request);
11401140
let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
1141-
destination: Destination::BlindedPath(invoice_request_path),
1141+
destination: Destination::BlindedPath(destination),
11421142
reply_path: reply_path.into_blinded_path(),
11431143
};
11441144
pending_offers_messages.push((message, instructions));

0 commit comments

Comments
 (0)