Avoid returning a reference to a u64.
[rust-lightning] / lightning-invoice / src / payment.rs
index 226e8fe42b8982cfe58e3fc8917a149cc86078d1..3b4fe7092bc38272882a14f71cf7741dd0cdc7ea 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)
        }
 }