From: Jeffrey Czyz Date: Thu, 6 Apr 2023 14:47:45 +0000 (-0500) Subject: Expose a BOLT 11 Invoice's signable_hash X-Git-Tag: v0.0.115~31^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=821c79da981a708f1a767d762f50db820e04444a;p=rust-lightning Expose a BOLT 11 Invoice's signable_hash Otherwise, an Invoice must first be converted to a SignedRawInvoice to obtain the hash. --- 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