Expose a BOLT 11 Invoice's signable_hash

Otherwise, an Invoice must first be converted to a SignedRawInvoice to
obtain the hash.
This commit is contained in:
Jeffrey Czyz 2023-04-06 09:47:45 -05:00
parent 854d650b5b
commit 821c79da98
No known key found for this signature in database
GPG key ID: 3A4E08275D5E96D2

View file

@ -1026,6 +1026,11 @@ impl From<PositiveTimestamp> 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