Skip to content

Commit 4c470be

Browse files
committed
f - docs about unknown, odd TLV records
1 parent 562c33a commit 4c470be

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lightning/src/offers/invoice.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> {
368368
}
369369

370370
/// A semantically valid [`Bolt12Invoice`] that hasn't been signed.
371+
///
372+
/// # Serialization
373+
///
374+
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
375+
/// such, it may include unknown, odd TLV records.
371376
pub struct UnsignedBolt12Invoice {
372377
bytes: Vec<u8>,
373378
contents: InvoiceContents,
@@ -396,7 +401,9 @@ impl UnsignedBolt12Invoice {
396401
self.contents.fields().signing_pubkey
397402
}
398403

399-
/// Signs the invoice using the given function.
404+
/// Signs the [`TaggedHash`] of the invoice using the given function.
405+
///
406+
/// Note: The hash computation may have included unknown, odd TLV records.
400407
///
401408
/// This is not exported to bindings users as functions aren't currently mapped.
402409
pub fn sign<F, E>(mut self, sign: F) -> Result<Bolt12Invoice, SignError<E>>

lightning/src/offers/invoice_request.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ impl<'a, 'b, P: PayerIdStrategy, T: secp256k1::Signing> InvoiceRequestBuilder<'a
344344
}
345345

346346
/// A semantically valid [`InvoiceRequest`] that hasn't been signed.
347+
///
348+
/// # Serialization
349+
///
350+
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
351+
/// such, it may include unknown, odd TLV records.
347352
pub struct UnsignedInvoiceRequest {
348353
bytes: Vec<u8>,
349354
contents: InvoiceRequestContents,
@@ -367,7 +372,9 @@ impl UnsignedInvoiceRequest {
367372
Self { bytes, contents, tagged_hash }
368373
}
369374

370-
/// Signs the invoice request using the given function.
375+
/// Signs the [`TaggedHash`] of the invoice request using the given function.
376+
///
377+
/// Note: The hash computation may have included unknown, odd TLV records.
371378
///
372379
/// This is not exported to bindings users as functions are not yet mapped.
373380
pub fn sign<F, E>(mut self, sign: F) -> Result<InvoiceRequest, SignError<E>>

0 commit comments

Comments
 (0)