X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-invoice%2Fsrc%2Flib.rs;h=5b326911444cece5a8b032732f9da24985b2ca25;hb=8354e0c9ba383d4f4df14c9735847a0b19a37f91;hp=9c6badad6d9962fb99800832fbb6849b2400270d;hpb=a854ccb9b5dfa762ae22e2e547630eb3f8e4235b;p=rust-lightning diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 9c6badad..5b326911 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1348,6 +1348,15 @@ impl Bolt11Invoice { self.signed_invoice.recover_payee_pub_key().expect("was checked by constructor").0 } + /// Recover the payee's public key if one was included in the invoice, otherwise return the + /// recovered public key from the signature + pub fn get_payee_pub_key(&self) -> PublicKey { + match self.payee_pub_key() { + Some(pk) => *pk, + None => self.recover_payee_pub_key() + } + } + /// Returns the Duration since the Unix epoch at which the invoice expires. /// Returning None if overflow occurred. pub fn expires_at(&self) -> Option {