(1, 2, 4, 5)
| 964 | } |
| 965 | |
| 966 | static void NON_NULL_ARGS(1, 2, 4, 5) json_add_channel(struct command *cmd, |
| 967 | struct json_stream *response, |
| 968 | const char *key, |
| 969 | const struct channel *channel, |
| 970 | const struct peer *peer) |
| 971 | { |
| 972 | struct lightningd *ld = cmd->ld; |
| 973 | struct amount_msat funding_msat; |
| 974 | struct amount_sat peer_funded_sats; |
| 975 | const struct peer_update *peer_update; |
| 976 | u32 feerate; |
| 977 | bool has_valid_inflights; |
| 978 | |
| 979 | json_object_start(response, key); |
| 980 | json_add_node_id(response, "peer_id", &peer->id); |
| 981 | json_add_bool(response, "peer_connected", peer->connected == PEER_CONNECTED); |
| 982 | if (peer->connected == PEER_CONNECTED) { |
| 983 | json_add_bool(response, "reestablished", channel->reestablished); |
| 984 | } |
| 985 | json_add_channel_type(response, "channel_type", channel->type); |
| 986 | if (channel->ignore_fee_limits) { |
| 987 | json_add_bool(response, "ignore_fee_limits", channel->ignore_fee_limits); |
| 988 | } |
| 989 | /* This reflects current gossip */ |
| 990 | json_object_start(response, "updates"); |
| 991 | json_object_start(response, "local"); |
| 992 | json_add_amount_msat(response, |
| 993 | "htlc_minimum_msat", |
| 994 | channel->htlc_minimum_msat); |
| 995 | json_add_amount_msat(response, |
| 996 | "htlc_maximum_msat", |
| 997 | channel->htlc_maximum_msat); |
| 998 | json_add_u32(response, "cltv_expiry_delta", ld->config.cltv_expiry_delta); |
| 999 | json_add_amount_msat(response, "fee_base_msat", |
| 1000 | amount_msat(channel->feerate_base)); |
| 1001 | json_add_u32(response, "fee_proportional_millionths", |
| 1002 | channel->feerate_ppm); |
| 1003 | json_object_end(response); |
| 1004 | |
| 1005 | peer_update = channel_gossip_get_remote_update(channel); |
| 1006 | if (peer_update) { |
| 1007 | json_object_start(response, "remote"); |
| 1008 | json_add_amount_msat(response, |
| 1009 | "htlc_minimum_msat", |
| 1010 | peer_update->htlc_minimum_msat); |
| 1011 | json_add_amount_msat(response, |
| 1012 | "htlc_maximum_msat", |
| 1013 | peer_update->htlc_maximum_msat); |
| 1014 | json_add_u32(response, "cltv_expiry_delta", peer_update->cltv_delta); |
| 1015 | json_add_amount_msat(response, "fee_base_msat", |
| 1016 | amount_msat(peer_update->fee_base)); |
| 1017 | json_add_u32(response, "fee_proportional_millionths", |
| 1018 | peer_update->fee_ppm); |
| 1019 | json_object_end(response); |
| 1020 | } |
| 1021 | json_object_end(response); |
| 1022 | |
| 1023 | if (channel->last_stable_connection != 0) { |
no test coverage detected