From 821c79da981a708f1a767d762f50db820e04444a Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Thu, 6 Apr 2023 09:47:45 -0500 Subject: [PATCH] Expose a BOLT 11 Invoice's signable_hash Otherwise, an Invoice must first be converted to a SignedRawInvoice to obtain the hash. --- lightning-invoice/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 0c73ebc9d..523777455 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1026,6 +1026,11 @@ impl From for SystemTime { } impl Invoice { + /// The hash of the [`RawInvoice`] that was signed. + pub fn signable_hash(&self) -> [u8; 32] { + self.signed_invoice.hash + } + /// Transform the `Invoice` into it's unchecked version pub fn into_signed_raw(self) -> SignedRawInvoice { self.signed_invoice -- 2.39.5