Skip to content

Commit 770a4ec

Browse files
fixup! feat(offers): add BOLT 12 payer proof primitives
fixup! feat(offers): add BOLT 12 payer proof primitives
1 parent fc54321 commit 770a4ec

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

lightning/src/offers/payer_proof.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ tlv_stream!(
510510
// includes them as leaves.
511511
tlv_stream!(
512512
PayerProofDataTlvStream, PayerProofDataTlvStreamRef<'a>, PAYER_PROOF_DATA_TYPES, {
513-
(PAYER_PROOF_PREIMAGE_TYPE, preimage: PaymentPreimage),
514-
(PAYER_PROOF_OMITTED_TLVS_TYPE, omitted_markers: (Vec<BigSize>, WithoutLength)),
515-
(PAYER_PROOF_MISSING_HASHES_TYPE, missing_hashes: (Vec<sha256::Hash>, WithoutLength)),
516-
(PAYER_PROOF_LEAF_HASHES_TYPE, leaf_hashes: (Vec<sha256::Hash>, WithoutLength)),
513+
(PAYER_PROOF_PREIMAGE_TYPE, proof_preimage: PaymentPreimage),
514+
(PAYER_PROOF_OMITTED_TLVS_TYPE, proof_omitted_markers: (Vec<BigSize>, WithoutLength)),
515+
(PAYER_PROOF_MISSING_HASHES_TYPE, proof_missing_hashes: (Vec<sha256::Hash>, WithoutLength)),
516+
(PAYER_PROOF_LEAF_HASHES_TYPE, proof_leaf_hashes: (Vec<sha256::Hash>, WithoutLength)),
517517
(PAYER_PROOF_PROOF_NOTE_TYPE, proof_note: (String, WithoutLength)),
518518
}
519519
);
@@ -605,15 +605,15 @@ impl UnsignedPayerProof<'_> {
605605
};
606606
signatures.write(&mut bytes).expect("Vec write should not fail");
607607

608-
let omitted_markers = (!self.disclosure.omitted_markers.is_empty()).then(|| {
608+
let proof_omitted_markers = (!self.disclosure.omitted_markers.is_empty()).then(|| {
609609
self.disclosure.omitted_markers.iter().copied().map(BigSize).collect::<Vec<_>>()
610610
});
611611
let data = PayerProofDataTlvStreamRef {
612-
preimage: Some(&self.preimage),
613-
omitted_markers: omitted_markers.as_ref(),
614-
missing_hashes: (!self.disclosure.missing_hashes.is_empty())
612+
proof_preimage: Some(&self.preimage),
613+
proof_omitted_markers: proof_omitted_markers.as_ref(),
614+
proof_missing_hashes: (!self.disclosure.missing_hashes.is_empty())
615615
.then_some(&self.disclosure.missing_hashes),
616-
leaf_hashes: (!self.disclosure.leaf_hashes.is_empty())
616+
proof_leaf_hashes: (!self.disclosure.leaf_hashes.is_empty())
617617
.then_some(&self.disclosure.leaf_hashes),
618618
proof_note: self.payer_note.as_ref(),
619619
};
@@ -774,10 +774,10 @@ impl TryFrom<FullPayerProofTlvStream> for ParsedPayerProofFields {
774774
InvoiceTlvStream { created_at, payment_hash, amount, node_id, .. },
775775
PayerProofSignatureTlvStream { invoice_signature, proof_signature },
776776
PayerProofDataTlvStream {
777-
preimage,
778-
omitted_markers,
779-
missing_hashes,
780-
leaf_hashes,
777+
proof_preimage,
778+
proof_omitted_markers,
779+
proof_missing_hashes,
780+
proof_leaf_hashes,
781781
proof_note,
782782
},
783783
_experimental_offer,
@@ -794,7 +794,7 @@ impl TryFrom<FullPayerProofTlvStream> for ParsedPayerProofFields {
794794
.ok_or(Bolt12ParseError::InvalidSemantics(Bolt12SemanticError::MissingSigningPubkey))?;
795795
let invoice_signature = invoice_signature
796796
.ok_or(Bolt12ParseError::InvalidSemantics(Bolt12SemanticError::MissingSignature))?;
797-
let preimage = preimage.ok_or(Bolt12ParseError::Decode(DecodeError::InvalidValue))?;
797+
let preimage = proof_preimage.ok_or(Bolt12ParseError::Decode(DecodeError::InvalidValue))?;
798798
let proof_signature = proof_signature
799799
.ok_or(Bolt12ParseError::InvalidSemantics(Bolt12SemanticError::MissingSignature))?;
800800

@@ -814,13 +814,13 @@ impl TryFrom<FullPayerProofTlvStream> for ParsedPayerProofFields {
814814
invoice_created_at: created_at.map(Duration::from_secs),
815815
},
816816
},
817-
omitted_markers: omitted_markers
817+
omitted_markers: proof_omitted_markers
818818
.unwrap_or_default()
819819
.into_iter()
820820
.map(|marker| marker.0)
821821
.collect(),
822-
missing_hashes: missing_hashes.unwrap_or_default(),
823-
leaf_hashes: leaf_hashes.unwrap_or_default(),
822+
missing_hashes: proof_missing_hashes.unwrap_or_default(),
823+
leaf_hashes: proof_leaf_hashes.unwrap_or_default(),
824824
})
825825
}
826826
}

0 commit comments

Comments
 (0)