From 3fc8b1cd20f5383fb8ad69ce239b55d0448773b2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 1 Feb 2021 13:29:34 +1030 Subject: [PATCH] common: fix gossmap min/max rounding. They were backwards. Signed-off-by: Rusty Russell --- common/gossmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/gossmap.c b/common/gossmap.c index d0b7be70c..9afbffef5 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -464,14 +464,15 @@ static void update_channel(struct gossmap *map, size_t cupdate_off) errx(1, "update for channel %s not found!", type_to_string(tmpctx, struct short_channel_id, &scid)); - hc.htlc_min = u64_to_fp16(map_be64(map, htlc_minimum_off), true); + /* We round this *down*, since too-low min is more conservative */ + hc.htlc_min = u64_to_fp16(map_be64(map, htlc_minimum_off), false); /* I checked my node: 60189 of 62358 channel_update have * htlc_maximum_msat, so we don't bother setting the rest to the * channel size (which we don't even read from the gossip_store, let * alone give up precious bytes to remember) */ if (map_u8(map, message_flags_off) & 1) hc.htlc_max - = u64_to_fp16(map_be64(map, htlc_maximum_off), false); + = u64_to_fp16(map_be64(map, htlc_maximum_off), true); else hc.htlc_max = 0xFFFF; hc.base_fee = map_be32(map, fee_base_off);