diff --git a/common/gossmap.c b/common/gossmap.c index 6397e1bd7..9ae3738e3 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -1289,3 +1289,22 @@ int gossmap_node_get_feature(const struct gossmap *map, return map_feature_test(map, COMPULSORY_FEATURE(fbit), n->nann_off + feature_len_off + 2, feature_len); } + +u8 *gossmap_node_get_features(const tal_t *ctx, + const struct gossmap *map, + const struct gossmap_node *n) +{ + u8 *ret; + /* Note that first two bytes are message type */ + const size_t feature_len_off = 2 + 64; + size_t feature_len; + + if (n->nann_off == 0) + return NULL; + + feature_len = map_be16(map, n->nann_off + feature_len_off); + ret = tal_arr(ctx, u8, feature_len); + + map_copy(map, n->nann_off + feature_len_off + 2, ret, feature_len); + return ret; +} diff --git a/common/gossmap.h b/common/gossmap.h index 5bda03c6e..b173c9bd5 100644 --- a/common/gossmap.h +++ b/common/gossmap.h @@ -134,21 +134,26 @@ u8 *gossmap_node_get_announce(const tal_t *ctx, const struct gossmap *map, const struct gossmap_node *n); -/* Return the feature bit (odd or even), or -1 if neither. */ +/* Return the channel feature bit (odd or even), or -1 if neither. */ int gossmap_chan_get_feature(const struct gossmap *map, const struct gossmap_chan *c, int fbit); -/* Return the feature bitmap */ +/* Return the channel feature bitmap */ u8 *gossmap_chan_get_features(const tal_t *ctx, const struct gossmap *map, const struct gossmap_chan *c); -/* Return the feature bit (odd or even), or -1 if neither (or no announcement) */ +/* Return the node feature bit (odd or even), or -1 if neither (or no announcement) */ int gossmap_node_get_feature(const struct gossmap *map, const struct gossmap_node *n, int fbit); +/* Return the node feature bitmap: NULL if no announcement. */ +u8 *gossmap_node_get_features(const tal_t *ctx, + const struct gossmap *map, + const struct gossmap_node *n); + /* Returns details from channel_update (must be gossmap_chan_set, and * does not work for local_updatechan! */ void gossmap_chan_get_update_details(const struct gossmap *map, diff --git a/plugins/topology.c b/plugins/topology.c index 116ba81e6..d98e04e45 100644 --- a/plugins/topology.c +++ b/plugins/topology.c @@ -577,6 +577,7 @@ static struct command_result *json_listincoming(struct command *cmd, struct gossmap_chan *ourchan; struct gossmap_node *peer; struct short_channel_id scid; + const u8 *peer_features; ourchan = gossmap_nth_chan(gossmap, me, i, &dir); /* If its half is disabled, ignore. */ @@ -593,6 +594,9 @@ static struct command_result *json_listincoming(struct command *cmd, json_add_amount_msat_only(js, "fee_base_msat", amount_msat(ourchan->half[!dir] .base_fee)); + json_add_amount_msat_only(js, "htlc_min_msat", + amount_msat(fp16_to_u64(ourchan->half[!dir] + .htlc_min))); json_add_amount_msat_only(js, "htlc_max_msat", amount_msat(fp16_to_u64(ourchan->half[!dir] .htlc_max))); @@ -602,6 +606,10 @@ static struct command_result *json_listincoming(struct command *cmd, json_add_amount_msat_only(js, "incoming_capacity_msat", peer_capacity(gossmap, me, peer, ourchan)); + json_add_bool(js, "public", !ourchan->private); + peer_features = gossmap_node_get_features(tmpctx, gossmap, peer); + if (peer_features) + json_add_hex_talarr(js, "peer_features", peer_features); json_object_end(js); } done: