Avoid returning a reference to a u64.
[rust-lightning] / lightning-invoice / src / payment.rs
index 05b12840179a629f661f61ea78a73fa751f20262..c7449acd2764085ac6ac250c9a07235b3a588019 100644 (file)
@@ -741,8 +741,8 @@ pub struct InFlightHtlcs(HashMap<(u64, bool), u64>);
 impl InFlightHtlcs {
        /// Returns liquidity in msat given the public key of the HTLC source, target, and short channel
        /// id.
-       pub fn used_liquidity_msat(&self, source: &NodeId, target: &NodeId, channel_scid: u64) -> Option<&u64> {
-               self.0.get(&(channel_scid, source < target))
+       pub fn used_liquidity_msat(&self, source: &NodeId, target: &NodeId, channel_scid: u64) -> Option<u64> {
+               self.0.get(&(channel_scid, source < target)).map(|v| *v)
        }
 }