Skip to content

Commit

Permalink
f request_paths -> offer_request_paths rename
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinewallace committed Jul 15, 2024
1 parent 807c9e2 commit 78e03fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions lightning/src/offers/invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// From [`Offer::paths`] or [`Refund::paths`].
///
/// [`Offer::paths`]: crate::offers::offer::Offer::paths
pub fn request_paths(&$self) -> &[BlindedPath] {
$contents.request_paths()
pub fn offer_request_paths(&$self) -> &[BlindedPath] {
$contents.offer_request_paths()
}

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

/// A possibly transient pubkey used to sign the invoice request or to send an invoice for a
/// refund in case there are no [`request_paths`].
/// refund in case there are no [`offer_request_paths`].
///
/// [`request_paths`]: Self::request_paths
/// [`offer_request_paths`]: Self::offer_request_paths
pub fn payer_id(&$self) -> PublicKey {
$contents.payer_id()
}
Expand Down Expand Up @@ -891,7 +891,7 @@ impl InvoiceContents {
}
}

fn request_paths(&self) -> &[BlindedPath] {
fn offer_request_paths(&self) -> &[BlindedPath] {
match self {
InvoiceContents::ForOffer { invoice_request, .. } => {
invoice_request.inner.offer.paths()
Expand Down Expand Up @@ -1475,7 +1475,7 @@ mod tests {
assert_eq!(unsigned_invoice.description(), Some(PrintableString("")));
assert_eq!(unsigned_invoice.offer_features(), Some(&OfferFeatures::empty()));
assert_eq!(unsigned_invoice.absolute_expiry(), None);
assert_eq!(unsigned_invoice.request_paths(), &[]);
assert_eq!(unsigned_invoice.offer_request_paths(), &[]);
assert_eq!(unsigned_invoice.issuer(), None);
assert_eq!(unsigned_invoice.supported_quantity(), Some(Quantity::One));
assert_eq!(unsigned_invoice.signing_pubkey(), recipient_pubkey());
Expand Down Expand Up @@ -1517,7 +1517,7 @@ mod tests {
assert_eq!(invoice.description(), Some(PrintableString("")));
assert_eq!(invoice.offer_features(), Some(&OfferFeatures::empty()));
assert_eq!(invoice.absolute_expiry(), None);
assert_eq!(invoice.request_paths(), &[]);
assert_eq!(invoice.offer_request_paths(), &[]);
assert_eq!(invoice.issuer(), None);
assert_eq!(invoice.supported_quantity(), Some(Quantity::One));
assert_eq!(invoice.signing_pubkey(), recipient_pubkey());
Expand Down Expand Up @@ -1614,7 +1614,7 @@ mod tests {
assert_eq!(invoice.description(), Some(PrintableString("")));
assert_eq!(invoice.offer_features(), None);
assert_eq!(invoice.absolute_expiry(), None);
assert_eq!(invoice.request_paths(), &[]);
assert_eq!(invoice.offer_request_paths(), &[]);
assert_eq!(invoice.issuer(), None);
assert_eq!(invoice.supported_quantity(), None);
assert_eq!(invoice.signing_pubkey(), recipient_pubkey());
Expand Down
12 changes: 6 additions & 6 deletions lightning/src/offers/static_invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// publicly reachable nodes. Taken from [`Offer::paths`].
///
/// [`Offer::paths`]: crate::offers::offer::Offer::paths
pub fn request_paths(&$self) -> &[BlindedPath] {
$contents.request_paths()
pub fn offer_request_paths(&$self) -> &[BlindedPath] {
$contents.offer_request_paths()
}

/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
Expand Down Expand Up @@ -395,7 +395,7 @@ impl InvoiceContents {
self.offer.issuer()
}

fn request_paths(&self) -> &[BlindedPath] {
fn offer_request_paths(&self) -> &[BlindedPath] {
self.offer.paths()
}

Expand Down Expand Up @@ -678,7 +678,7 @@ mod tests {
assert_eq!(invoice.description(), None);
assert_eq!(invoice.offer_features(), &OfferFeatures::empty());
assert_eq!(invoice.absolute_expiry(), None);
assert_eq!(invoice.request_paths(), &[blinded_path()]);
assert_eq!(invoice.offer_request_paths(), &[blinded_path()]);
assert_eq!(invoice.message_paths(), &[blinded_path()]);
assert_eq!(invoice.issuer(), None);
assert_eq!(invoice.supported_quantity(), Quantity::One);
Expand Down Expand Up @@ -1137,8 +1137,8 @@ mod tests {
#[test]
fn fails_parsing_invoice_with_invalid_offer_fields() {
// Error if the offer is missing paths.
let missing_request_paths_invoice = invoice();
let mut tlv_stream = missing_request_paths_invoice.as_tlv_stream();
let missing_offer_request_paths_invoice = invoice();
let mut tlv_stream = missing_offer_request_paths_invoice.as_tlv_stream();
tlv_stream.0.paths = None;
match StaticInvoice::try_from(tlv_stream_to_bytes(&tlv_stream)) {
Ok(_) => panic!("expected error"),
Expand Down

0 comments on commit 78e03fa

Please sign in to comment.