Skip to content

Commit 4d3dd26

Browse files
committed
f - Make TaggedHash fields pub
1 parent 6302342 commit 4d3dd26

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

lightning/src/offers/invoice.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ use std::time::SystemTime;
126126

127127
const DEFAULT_RELATIVE_EXPIRY: Duration = Duration::from_secs(7200);
128128

129-
pub(super) const SIGNATURE_TAG: &'static str = concat!("lightning", "invoice", "signature");
129+
/// Tag for the hash function used when signing a [`Bolt12Invoice`]'s merkle root.
130+
pub const SIGNATURE_TAG: &'static str = concat!("lightning", "invoice", "signature");
130131

131132
/// Builds a [`Bolt12Invoice`] from either:
132133
/// - an [`InvoiceRequest`] for the "offer to be paid" flow or

lightning/src/offers/invoice_request.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ use crate::util::string::PrintableString;
7676

7777
use crate::prelude::*;
7878

79-
const SIGNATURE_TAG: &'static str = concat!("lightning", "invoice_request", "signature");
79+
/// Tag for the hash function used when signing an [`InvoiceRequest`]'s merkle root.
80+
pub const SIGNATURE_TAG: &'static str = concat!("lightning", "invoice_request", "signature");
8081

8182
pub(super) const IV_BYTES: &[u8; IV_LEN] = b"LDK Invreq ~~~~~";
8283

lightning/src/offers/merkle.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@ tlv_stream!(SignatureTlvStream, SignatureTlvStreamRef, SIGNATURE_TYPES, {
3333
/// [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
3434
/// [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation
3535
pub struct TaggedHash<'a> {
36-
tag: &'a str,
37-
tlv_stream: &'a [u8],
36+
/// Tag used for the hash function as defined in BOLT 12. Typically, either
37+
/// [`invoice_request::SIGNATURE_TAG`] or [`invoice::SIGNATURE_TAG`].
38+
///
39+
/// [`invoice::SIGNATURE_TAG`]: crate::offers::invoice::SIGNATURE_TAG
40+
/// [`invoice_request::SIGNATURE_TAG`]: crate::offers::invoice_request::SIGNATURE_TAG
41+
pub tag: &'a str,
42+
43+
/// The TLV stream bytes to compute the tagged hash over.
44+
pub tlv_stream: &'a [u8],
45+
46+
/// The cached digest to sign.
3847
digest: RefCell<Option<Message>>,
3948
}
4049

0 commit comments

Comments
 (0)