From: Matt Corallo Date: Fri, 23 Apr 2021 00:25:55 +0000 (+0000) Subject: Do not return a reference to a u64 in rust-lightning-invoices X-Git-Tag: v0.0.14~9^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=236342332ea272d47be1043197a3817d5d0482da;p=rust-lightning Do not return a reference to a u64 in rust-lightning-invoices There is generally never a reason to return a non-mutable reference to a u64 vs just copying it, same applies here. It makes the API slightly less consistent, but is easier to map in bindings and just makes more sense. --- diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 3d75d4d65..5a9c094c6 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1029,8 +1029,8 @@ impl Invoice { } /// Returns the invoice's `min_cltv_expiry` time if present - pub fn min_final_cltv_expiry(&self) -> Option<&u64> { - self.signed_invoice.min_final_cltv_expiry().map(|x| &x.0) + pub fn min_final_cltv_expiry(&self) -> Option { + self.signed_invoice.min_final_cltv_expiry().map(|x| x.0) } /// Returns a list of all fallback addresses @@ -1591,7 +1591,7 @@ mod test { ); assert_eq!(invoice.payee_pub_key(), Some(&public_key)); assert_eq!(invoice.expiry_time(), Duration::from_secs(54321)); - assert_eq!(invoice.min_final_cltv_expiry(), Some(&144)); + assert_eq!(invoice.min_final_cltv_expiry(), Some(144)); assert_eq!(invoice.fallbacks(), vec![&Fallback::PubKeyHash([0;20])]); assert_eq!(invoice.routes(), vec![&RouteHint(route_1), &RouteHint(route_2)]); assert_eq!(