Skip to content

Commit 96bac66

Browse files
f remove message from name
1 parent f2d91c4 commit 96bac66

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

lightning/src/offers/static_invoice.rs

+17-22
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct InvoiceContents {
7777
fallbacks: Option<Vec<FallbackAddress>>,
7878
features: Bolt12InvoiceFeatures,
7979
signing_pubkey: PublicKey,
80-
async_receive_message_paths: Vec<BlindedPath>,
80+
async_receive_paths: Vec<BlindedPath>,
8181
}
8282

8383
/// Builds a [`StaticInvoice`] from an [`Offer`].
@@ -98,17 +98,14 @@ impl<'a> StaticInvoiceBuilder<'a> {
9898
/// after `created_at`.
9999
pub fn for_offer_using_derived_keys<T: secp256k1::Signing>(
100100
offer: &'a Offer, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
101-
async_receive_message_paths: Vec<BlindedPath>, created_at: Duration,
102-
expanded_key: &ExpandedKey, secp_ctx: &Secp256k1<T>,
101+
async_receive_paths: Vec<BlindedPath>, created_at: Duration, expanded_key: &ExpandedKey,
102+
secp_ctx: &Secp256k1<T>,
103103
) -> Result<Self, Bolt12SemanticError> {
104104
if offer.chains().len() > 1 {
105105
return Err(Bolt12SemanticError::UnexpectedChain);
106106
}
107107

108-
if payment_paths.is_empty()
109-
|| async_receive_message_paths.is_empty()
110-
|| offer.paths().is_empty()
111-
{
108+
if payment_paths.is_empty() || async_receive_paths.is_empty() || offer.paths().is_empty() {
112109
return Err(Bolt12SemanticError::MissingPaths);
113110
}
114111

@@ -129,7 +126,7 @@ impl<'a> StaticInvoiceBuilder<'a> {
129126
let invoice = InvoiceContents::new(
130127
offer,
131128
payment_paths,
132-
async_receive_message_paths,
129+
async_receive_paths,
133130
created_at,
134131
signing_pubkey,
135132
);
@@ -238,8 +235,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
238235

239236
/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
240237
/// come online.
241-
pub fn async_receive_message_paths(&$self) -> &[BlindedPath] {
242-
$contents.async_receive_message_paths()
238+
pub fn async_receive_paths(&$self) -> &[BlindedPath] {
239+
$contents.async_receive_paths()
243240
}
244241

245242
/// The quantity of items supported, from [`Offer::supported_quantity`].
@@ -335,13 +332,12 @@ impl InvoiceContents {
335332

336333
fn new(
337334
offer: &Offer, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
338-
async_receive_message_paths: Vec<BlindedPath>, created_at: Duration,
339-
signing_pubkey: PublicKey,
335+
async_receive_paths: Vec<BlindedPath>, created_at: Duration, signing_pubkey: PublicKey,
340336
) -> Self {
341337
Self {
342338
offer: offer.contents.clone(),
343339
payment_paths,
344-
async_receive_message_paths,
340+
async_receive_paths,
345341
created_at,
346342
relative_expiry: None,
347343
fallbacks: None,
@@ -361,7 +357,7 @@ impl InvoiceContents {
361357

362358
let invoice = InvoiceTlvStreamRef {
363359
paths: Some(Iterable(self.payment_paths.iter().map(|(_, path)| path))),
364-
invoice_message_paths: Some(self.async_receive_message_paths.as_ref()),
360+
invoice_message_paths: Some(self.async_receive_paths.as_ref()),
365361
blindedpay: Some(Iterable(self.payment_paths.iter().map(|(payinfo, _)| payinfo))),
366362
created_at: Some(self.created_at.as_secs()),
367363
relative_expiry: self.relative_expiry.map(|duration| duration.as_secs() as u32),
@@ -408,8 +404,8 @@ impl InvoiceContents {
408404
self.offer.paths()
409405
}
410406

411-
fn async_receive_message_paths(&self) -> &[BlindedPath] {
412-
&self.async_receive_message_paths[..]
407+
fn async_receive_paths(&self) -> &[BlindedPath] {
408+
&self.async_receive_paths[..]
413409
}
414410

415411
fn supported_quantity(&self) -> Quantity {
@@ -533,8 +529,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
533529
}
534530

535531
let payment_paths = construct_payment_paths(blindedpay, paths)?;
536-
let async_receive_message_paths =
537-
invoice_message_paths.ok_or(Bolt12SemanticError::MissingPaths)?;
532+
let async_receive_paths = invoice_message_paths.ok_or(Bolt12SemanticError::MissingPaths)?;
538533

539534
let created_at = match created_at {
540535
None => return Err(Bolt12SemanticError::MissingCreationTime),
@@ -558,7 +553,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
558553
Ok(InvoiceContents {
559554
offer: OfferContents::try_from(offer_tlv_stream)?,
560555
payment_paths,
561-
async_receive_message_paths,
556+
async_receive_paths,
562557
created_at,
563558
relative_expiry,
564559
fallbacks,
@@ -689,7 +684,7 @@ mod tests {
689684
assert_eq!(invoice.offer_features(), &OfferFeatures::empty());
690685
assert_eq!(invoice.absolute_expiry(), None);
691686
assert_eq!(invoice.request_paths(), &[blinded_path()]);
692-
assert_eq!(invoice.async_receive_message_paths(), &[blinded_path()]);
687+
assert_eq!(invoice.async_receive_paths(), &[blinded_path()]);
693688
assert_eq!(invoice.issuer(), None);
694689
assert_eq!(invoice.supported_quantity(), Quantity::One);
695690
assert_ne!(invoice.signing_pubkey(), recipient_pubkey());
@@ -1065,8 +1060,8 @@ mod tests {
10651060
}
10661061

10671062
// Error if message paths are missing.
1068-
let missing_async_receive_message_paths_invoice = invoice();
1069-
let mut tlv_stream = missing_async_receive_message_paths_invoice.as_tlv_stream();
1063+
let missing_async_receive_paths_invoice = invoice();
1064+
let mut tlv_stream = missing_async_receive_paths_invoice.as_tlv_stream();
10701065
tlv_stream.1.invoice_message_paths = None;
10711066
match StaticInvoice::try_from(tlv_stream_to_bytes(&tlv_stream)) {
10721067
Ok(_) => panic!("expected error"),

0 commit comments

Comments
 (0)