Skip to content

Commit 49a0233

Browse files
authored
Merge pull request #1575 from NicolaLS/hash-invoice
2 parents 65d71cd + e263d90 commit 49a0233

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning-invoice/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub struct InvoiceBuilder<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S:
239239
/// 1. using `InvoiceBuilder`
240240
/// 2. using `Invoice::from_signed(SignedRawInvoice)`
241241
/// 3. using `str::parse::<Invoice>(&str)`
242-
#[derive(Eq, PartialEq, Debug, Clone)]
242+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
243243
pub struct Invoice {
244244
signed_invoice: SignedRawInvoice,
245245
}
@@ -263,7 +263,7 @@ pub enum InvoiceDescription<'f> {
263263
///
264264
/// # Invariants
265265
/// The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
266-
#[derive(Eq, PartialEq, Debug, Clone)]
266+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
267267
pub struct SignedRawInvoice {
268268
/// The rawInvoice that the signature belongs to
269269
raw_invoice: RawInvoice,
@@ -286,7 +286,7 @@ pub struct SignedRawInvoice {
286286
/// De- and encoding should not lead to information loss but may lead to different hashes.
287287
///
288288
/// For methods without docs see the corresponding methods in `Invoice`.
289-
#[derive(Eq, PartialEq, Debug, Clone)]
289+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
290290
pub struct RawInvoice {
291291
/// human readable part
292292
pub hrp: RawHrp,
@@ -298,7 +298,7 @@ pub struct RawInvoice {
298298
/// Data of the `RawInvoice` that is encoded in the human readable part
299299
///
300300
/// (C-not exported) As we don't yet support Option<Enum>
301-
#[derive(Eq, PartialEq, Debug, Clone)]
301+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
302302
pub struct RawHrp {
303303
/// The currency deferred from the 3rd and 4th character of the bech32 transaction
304304
pub currency: Currency,
@@ -311,7 +311,7 @@ pub struct RawHrp {
311311
}
312312

313313
/// Data of the `RawInvoice` that is encoded in the data part
314-
#[derive(Eq, PartialEq, Debug, Clone)]
314+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
315315
pub struct RawDataPart {
316316
/// generation time of the invoice
317317
pub timestamp: PositiveTimestamp,
@@ -326,11 +326,11 @@ pub struct RawDataPart {
326326
///
327327
/// The Unix timestamp representing the stored time has to be positive and no greater than
328328
/// [`MAX_TIMESTAMP`].
329-
#[derive(Eq, PartialEq, Debug, Clone)]
329+
#[derive(Eq, PartialEq, Debug, Clone, Hash)]
330330
pub struct PositiveTimestamp(Duration);
331331

332332
/// SI prefixes for the human readable part
333-
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
333+
#[derive(Eq, PartialEq, Debug, Clone, Copy, Hash)]
334334
pub enum SiPrefix {
335335
/// 10^-3
336336
Milli,
@@ -456,7 +456,7 @@ pub enum Fallback {
456456
}
457457

458458
/// Recoverable signature
459-
#[derive(Clone, Debug, Eq, PartialEq)]
459+
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
460460
pub struct InvoiceSignature(pub RecoverableSignature);
461461

462462
/// Private routing information

0 commit comments

Comments
 (0)