Skip to content

Commit 85c471a

Browse files
committed
Move BOLT 12 InvoiceRequest method implementations
1 parent 270bc2e commit 85c471a

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

lightning/src/offers/invoice_request.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,29 +460,28 @@ impl InvoiceRequest {
460460
///
461461
/// [`chain`]: Self::chain
462462
pub fn amount_msats(&self) -> Option<u64> {
463-
self.contents.inner.amount_msats
463+
self.contents.amount_msats()
464464
}
465465

466466
/// Features pertaining to requesting an invoice.
467467
pub fn features(&self) -> &InvoiceRequestFeatures {
468-
&self.contents.inner.features
468+
&self.contents.features()
469469
}
470470

471471
/// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
472472
pub fn quantity(&self) -> Option<u64> {
473-
self.contents.inner.quantity
473+
self.contents.quantity()
474474
}
475475

476476
/// A possibly transient pubkey used to sign the invoice request.
477477
pub fn payer_id(&self) -> PublicKey {
478-
self.contents.payer_id
478+
self.contents.payer_id()
479479
}
480480

481481
/// A payer-provided note which will be seen by the recipient and reflected back in the invoice
482482
/// response.
483483
pub fn payer_note(&self) -> Option<PrintableString> {
484-
self.contents.inner.payer_note.as_ref()
485-
.map(|payer_note| PrintableString(payer_note.as_str()))
484+
self.contents.payer_note()
486485
}
487486

488487
/// Signature of the invoice request using [`payer_id`].
@@ -626,10 +625,27 @@ impl InvoiceRequestContents {
626625
self.inner.chain()
627626
}
628627

628+
fn amount_msats(&self) -> Option<u64> {
629+
self.inner.amount_msats
630+
}
631+
632+
fn features(&self) -> &InvoiceRequestFeatures {
633+
&self.inner.features
634+
}
635+
636+
fn quantity(&self) -> Option<u64> {
637+
self.inner.quantity
638+
}
639+
629640
pub(super) fn payer_id(&self) -> PublicKey {
630641
self.payer_id
631642
}
632643

644+
fn payer_note(&self) -> Option<PrintableString> {
645+
self.inner.payer_note.as_ref()
646+
.map(|payer_note| PrintableString(payer_note.as_str()))
647+
}
648+
633649
pub(super) fn as_tlv_stream(&self) -> PartialInvoiceRequestTlvStreamRef {
634650
let (payer, offer, mut invoice_request) = self.inner.as_tlv_stream();
635651
invoice_request.payer_id = Some(&self.payer_id);

0 commit comments

Comments
 (0)