From: Yuntai Kyong Date: Fri, 17 Aug 2018 17:12:58 +0000 (-0400) Subject: add 1% chnnel reserve while keeping min value X-Git-Tag: v0.0.12~347^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=69624a8556d67e897efb057aae4e53a6aee4c948;p=rust-lightning add 1% chnnel reserve while keeping min value if 1000 is always used it will almost always fail test reserve < dust_limit check --- diff --git a/src/ln/channel.rs b/src/ln/channel.rs index e2749ffff..d7729a1ec 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -360,7 +360,8 @@ impl Channel { /// Guaranteed to return a value no larger than channel_value_satoshis fn get_our_channel_reserve_satoshis(channel_value_satoshis: u64) -> u64 { - cmp::min(channel_value_satoshis, 1000) //TODO + let (q, _) = channel_value_satoshis.overflowing_div(100); + cmp::min(channel_value_satoshis, cmp::max(q, 1000)) //TODO } fn derive_our_dust_limit_satoshis(at_open_background_feerate: u64) -> u64 {