From 69624a8556d67e897efb057aae4e53a6aee4c948 Mon Sep 17 00:00:00 2001 From: Yuntai Kyong Date: Fri, 17 Aug 2018 13:12:58 -0400 Subject: [PATCH] add 1% chnnel reserve while keeping min value if 1000 is always used it will almost always fail test reserve < dust_limit check --- src/ln/channel.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 { -- 2.39.5