diff --git a/common/gossmap.c b/common/gossmap.c index 0849fcfc6..b5d326938 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -1228,7 +1228,6 @@ void gossmap_chan_get_update_details(const struct gossmap *map, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_minimum_msat, - /* iff message_flags & 1 */ struct amount_msat *htlc_maximum_msat) { /* Note that first two bytes are message type */ @@ -1241,18 +1240,15 @@ void gossmap_chan_get_update_details(const struct gossmap *map, const size_t fee_base_off = htlc_minimum_off + 8; const size_t fee_prop_off = fee_base_off + 4; const size_t htlc_maximum_off = fee_prop_off + 4; - u8 mflags; assert(gossmap_chan_set(chan, dir)); if (timestamp) *timestamp = map_be32(map, timestamp_off); - /* We need this (below), even if they don't want it */ - mflags = map_u8(map, message_flags_off); - if (message_flags) - *message_flags = mflags; if (channel_flags) *channel_flags = map_u8(map, channel_flags_off); + if (message_flags) + *message_flags = map_u8(map, message_flags_off); if (fee_base_msat) *fee_base_msat = map_be32(map, fee_base_off); if (fee_proportional_millionths) @@ -1260,7 +1256,7 @@ void gossmap_chan_get_update_details(const struct gossmap *map, if (htlc_minimum_msat) *htlc_minimum_msat = amount_msat(map_be64(map, htlc_minimum_off)); - if (htlc_maximum_msat && (mflags & 1)) + if (htlc_maximum_msat) *htlc_maximum_msat = amount_msat(map_be64(map, htlc_maximum_off)); } diff --git a/common/gossmap.h b/common/gossmap.h index 38cee0425..6b08ef684 100644 --- a/common/gossmap.h +++ b/common/gossmap.h @@ -161,7 +161,6 @@ void gossmap_chan_get_update_details(const struct gossmap *map, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_minimum_msat, - /* iff message_flags & 1 */ struct amount_msat *htlc_maximum_msat); /* Given a struct node, get the nth channel, and tell us if we're half[0/1]. diff --git a/contrib/pyln-testing/pyln/testing/gossip.py b/contrib/pyln-testing/pyln/testing/gossip.py index 36976e462..eb7ce99f4 100644 --- a/contrib/pyln-testing/pyln/testing/gossip.py +++ b/contrib/pyln-testing/pyln/testing/gossip.py @@ -251,11 +251,7 @@ class ChannelUpdate(object): (cu.htlc_minimum_msat,) = struct.unpack("!Q", b.read(8)) (cu.fee_base_msat,) = struct.unpack("!I", b.read(4)) (cu.fee_proportional_millionths,) = struct.unpack("!I", b.read(4)) - t = b.read(8) - if len(t) == 8: - (cu.htlc_maximum_msat,) = struct.unpack("!Q", t) - else: - cu.htlc_maximum_msat = None + (cu.htlc_maximum_msat,) = struct.unpack("!Q", b.read(8)) return cu diff --git a/gossipd/routing.c b/gossipd/routing.c index 8e8a913ad..08aef559e 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -1322,21 +1322,10 @@ bool routing_add_channel_update(struct routing_state *rstate, sat = uc->sat; } - if (message_flags & ROUTING_OPT_HTLC_MAX_MSAT) { - /* Reject update if the `htlc_maximum_msat` is greater - * than the total available channel satoshis */ - if (amount_msat_greater_sat(htlc_maximum, sat)) - return false; - } else { - /* If not indicated, set htlc_max_msat to channel capacity */ - if (!amount_sat_to_msat(&htlc_maximum, sat)) { - status_peer_broken(peer ? &peer->id : NULL, - "Channel capacity %s overflows!", - type_to_string(tmpctx, struct amount_sat, - &sat)); - return false; - } - } + /* Reject update if the `htlc_maximum_msat` is greater + * than the total available channel satoshis */ + if (amount_msat_greater_sat(htlc_maximum, sat)) + return false; /* Check timestamp is sane (unless from store). */ if (!index && !timestamp_reasonable(rstate, timestamp)) { diff --git a/plugins/topology.c b/plugins/topology.c index d20e65a8b..116ba81e6 100644 --- a/plugins/topology.c +++ b/plugins/topology.c @@ -280,10 +280,8 @@ static void json_add_halfchan(struct json_stream *response, json_add_num(response, "delay", c->half[dir].delay); json_add_amount_msat_only(response, "htlc_minimum_msat", htlc_minimum_msat); - - if (message_flags & 1) - json_add_amount_msat_only(response, "htlc_maximum_msat", - htlc_maximum_msat); + json_add_amount_msat_only(response, "htlc_maximum_msat", + htlc_maximum_msat); json_add_hex_talarr(response, "features", chanfeatures); json_object_end(response); }