Skip to content

Commit afe8915

Browse files
committed
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.
1 parent a8bc8fb commit afe8915

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning-invoice/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,8 @@ impl Invoice {
10291029
}
10301030

10311031
/// Returns the invoice's `min_cltv_expiry` time if present
1032-
pub fn min_final_cltv_expiry(&self) -> Option<&u64> {
1033-
self.signed_invoice.min_final_cltv_expiry().map(|x| &x.0)
1032+
pub fn min_final_cltv_expiry(&self) -> Option<u64> {
1033+
self.signed_invoice.min_final_cltv_expiry().map(|x| x.0)
10341034
}
10351035

10361036
/// Returns a list of all fallback addresses
@@ -1591,7 +1591,7 @@ mod test {
15911591
);
15921592
assert_eq!(invoice.payee_pub_key(), Some(&public_key));
15931593
assert_eq!(invoice.expiry_time(), Duration::from_secs(54321));
1594-
assert_eq!(invoice.min_final_cltv_expiry(), Some(&144));
1594+
assert_eq!(invoice.min_final_cltv_expiry(), Some(144));
15951595
assert_eq!(invoice.fallbacks(), vec![&Fallback::PubKeyHash([0;20])]);
15961596
assert_eq!(invoice.routes(), vec![&RouteHint(route_1), &RouteHint(route_2)]);
15971597
assert_eq!(

0 commit comments

Comments
 (0)