Skip to content

Commit 2edd55e

Browse files
committed
f - add clarifying comments
1 parent 12da536 commit 2edd55e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lightning/src/offers/offer.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,13 @@ macro_rules! offer_builder_methods { (
384384
}
385385

386386
fn build_without_checks($($self_mut)* $self: $self_type) -> Offer {
387-
// Create the metadata for stateless verification of an InvoiceRequest.
388387
if let Some(mut metadata) = $self.offer.metadata.take() {
388+
389+
// Create the metadata for stateless verification of an InvoiceRequest.
389390
if metadata.has_derivation_material() {
391+
392+
// Don't derive keys if no blinded paths were given since this means the signing
393+
// pubkey must be the node id of an announced node.
390394
if $self.offer.paths.is_none() {
391395
metadata = metadata.without_keys();
392396
}
@@ -398,6 +402,9 @@ macro_rules! offer_builder_methods { (
398402
tlv_stream.node_id = None;
399403
}
400404

405+
// Either replace the signing pubkey with the derived pubkey or include the metadata
406+
// for verification. In the former case, the blinded paths must include the metadata
407+
// instead.
401408
let (derived_metadata, keys) = metadata.derive_from(tlv_stream, $self.secp_ctx);
402409
match keys {
403410
Some(keys) => $self.offer.signing_pubkey = Some(keys.public_key()),

0 commit comments

Comments
 (0)