Skip to content

Commit 0df740f

Browse files
Rename {Bolt12,Static}Invoice offer paths accessors to be more specific.
1 parent 9c7e557 commit 0df740f

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lightning/src/offers/invoice.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
690690
/// From [`Offer::paths`] or [`Refund::paths`].
691691
///
692692
/// [`Offer::paths`]: crate::offers::offer::Offer::paths
693-
pub fn message_paths(&$self) -> &[BlindedPath] {
694-
$contents.message_paths()
693+
pub fn request_paths(&$self) -> &[BlindedPath] {
694+
$contents.request_paths()
695695
}
696696

697697
/// The quantity of items supported.
@@ -726,9 +726,9 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
726726
}
727727

728728
/// A possibly transient pubkey used to sign the invoice request or to send an invoice for a
729-
/// refund in case there are no [`message_paths`].
729+
/// refund in case there are no [`request_paths`].
730730
///
731-
/// [`message_paths`]: Self::message_paths
731+
/// [`request_paths`]: Self::request_paths
732732
pub fn payer_id(&$self) -> PublicKey {
733733
$contents.payer_id()
734734
}
@@ -891,7 +891,7 @@ impl InvoiceContents {
891891
}
892892
}
893893

894-
fn message_paths(&self) -> &[BlindedPath] {
894+
fn request_paths(&self) -> &[BlindedPath] {
895895
match self {
896896
InvoiceContents::ForOffer { invoice_request, .. } => {
897897
invoice_request.inner.offer.paths()
@@ -1468,7 +1468,7 @@ mod tests {
14681468
assert_eq!(unsigned_invoice.description(), Some(PrintableString("")));
14691469
assert_eq!(unsigned_invoice.offer_features(), Some(&OfferFeatures::empty()));
14701470
assert_eq!(unsigned_invoice.absolute_expiry(), None);
1471-
assert_eq!(unsigned_invoice.message_paths(), &[]);
1471+
assert_eq!(unsigned_invoice.request_paths(), &[]);
14721472
assert_eq!(unsigned_invoice.issuer(), None);
14731473
assert_eq!(unsigned_invoice.supported_quantity(), Some(Quantity::One));
14741474
assert_eq!(unsigned_invoice.signing_pubkey(), recipient_pubkey());
@@ -1510,7 +1510,7 @@ mod tests {
15101510
assert_eq!(invoice.description(), Some(PrintableString("")));
15111511
assert_eq!(invoice.offer_features(), Some(&OfferFeatures::empty()));
15121512
assert_eq!(invoice.absolute_expiry(), None);
1513-
assert_eq!(invoice.message_paths(), &[]);
1513+
assert_eq!(invoice.request_paths(), &[]);
15141514
assert_eq!(invoice.issuer(), None);
15151515
assert_eq!(invoice.supported_quantity(), Some(Quantity::One));
15161516
assert_eq!(invoice.signing_pubkey(), recipient_pubkey());
@@ -1607,7 +1607,7 @@ mod tests {
16071607
assert_eq!(invoice.description(), Some(PrintableString("")));
16081608
assert_eq!(invoice.offer_features(), None);
16091609
assert_eq!(invoice.absolute_expiry(), None);
1610-
assert_eq!(invoice.message_paths(), &[]);
1610+
assert_eq!(invoice.request_paths(), &[]);
16111611
assert_eq!(invoice.issuer(), None);
16121612
assert_eq!(invoice.supported_quantity(), None);
16131613
assert_eq!(invoice.signing_pubkey(), recipient_pubkey());

lightning/src/offers/static_invoice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
227227
/// publicly reachable nodes. Taken from [`Offer::paths`].
228228
///
229229
/// [`Offer::paths`]: crate::offers::offer::Offer::paths
230-
pub fn offer_message_paths(&$self) -> &[BlindedPath] {
231-
$contents.offer_message_paths()
230+
pub fn request_paths(&$self) -> &[BlindedPath] {
231+
$contents.request_paths()
232232
}
233233

234234
/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
@@ -398,7 +398,7 @@ impl InvoiceContents {
398398
self.offer.issuer()
399399
}
400400

401-
fn offer_message_paths(&self) -> &[BlindedPath] {
401+
fn request_paths(&self) -> &[BlindedPath] {
402402
self.offer.paths()
403403
}
404404

@@ -682,7 +682,7 @@ mod tests {
682682
assert_eq!(invoice.description(), None);
683683
assert_eq!(invoice.offer_features(), &OfferFeatures::empty());
684684
assert_eq!(invoice.absolute_expiry(), None);
685-
assert_eq!(invoice.offer_message_paths(), &[blinded_path()]);
685+
assert_eq!(invoice.request_paths(), &[blinded_path()]);
686686
assert_eq!(invoice.message_paths(), &[blinded_path()]);
687687
assert_eq!(invoice.issuer(), None);
688688
assert_eq!(invoice.supported_quantity(), Quantity::One);
@@ -1141,8 +1141,8 @@ mod tests {
11411141
#[test]
11421142
fn fails_parsing_invoice_with_invalid_offer_fields() {
11431143
// Error if the offer is missing paths.
1144-
let missing_offer_paths_invoice = invoice();
1145-
let mut tlv_stream = missing_offer_paths_invoice.as_tlv_stream();
1144+
let missing_request_paths_invoice = invoice();
1145+
let mut tlv_stream = missing_request_paths_invoice.as_tlv_stream();
11461146
tlv_stream.0.paths = None;
11471147
match StaticInvoice::try_from(tlv_stream_to_bytes(&tlv_stream)) {
11481148
Ok(_) => panic!("expected error"),

0 commit comments

Comments
 (0)