| 2905 | } |
| 2906 | |
| 2907 | static struct json_stream *build_commit_response(struct command *cmd, |
| 2908 | struct channel *channel, |
| 2909 | struct channel_inflight *inflight) |
| 2910 | { |
| 2911 | struct json_stream *response; |
| 2912 | |
| 2913 | response = json_stream_success(cmd); |
| 2914 | json_add_string(response, "channel_id", |
| 2915 | fmt_channel_id(tmpctx, &channel->cid)); |
| 2916 | json_add_psbt(response, "psbt", inflight->funding_psbt); |
| 2917 | json_add_channel_type(response, "channel_type", channel->type); |
| 2918 | json_add_bool(response, "commitments_secured", inflight->last_tx != NULL); |
| 2919 | /* For convenience sake, we include the funding outnum */ |
| 2920 | assert(inflight->funding); |
| 2921 | json_add_num(response, "funding_outnum", inflight->funding->outpoint.n); |
| 2922 | /* This is *sort of* dicey, since there's a small chance the channel |
| 2923 | * might disconnect/reconnect and we lose the open-attempt data */ |
| 2924 | if (channel->open_attempt && channel->open_attempt->our_upfront_shutdown_script) { |
| 2925 | /* FIXME: also include the output as address */ |
| 2926 | json_add_hex_talarr(response, "close_to", |
| 2927 | channel->open_attempt->our_upfront_shutdown_script); |
| 2928 | /* Worse case is that we accidentally report what we're 'closing-to' even if you |
| 2929 | * didn't request it? We *could* just announce it every time... */ |
| 2930 | } else if (!channel->open_attempt && channel->shutdown_scriptpubkey[LOCAL]) { |
| 2931 | json_add_hex_talarr(response, "close_to", |
| 2932 | channel->shutdown_scriptpubkey[LOCAL]); |
| 2933 | /* FIXME: also include the output as address */ |
| 2934 | } |
| 2935 | return response; |
| 2936 | } |
| 2937 | |
| 2938 | static struct command_result *json_openchannel_update(struct command *cmd, |
| 2939 | const char *buffer, |
no test coverage detected