| 3810 | } |
| 3811 | |
| 3812 | static struct command_result *json_sign_last_tx(struct command *cmd, |
| 3813 | const char *buffer, |
| 3814 | const jsmntok_t *obj UNNEEDED, |
| 3815 | const jsmntok_t *params) |
| 3816 | { |
| 3817 | struct json_stream *response; |
| 3818 | struct channel *channel; |
| 3819 | struct bitcoin_tx *tx; |
| 3820 | |
| 3821 | if (!param(cmd, buffer, params, |
| 3822 | p_req("id", param_dev_channel, &channel), |
| 3823 | NULL)) |
| 3824 | return command_param_failed(); |
| 3825 | |
| 3826 | response = json_stream_success(cmd); |
| 3827 | log_debug(channel->log, "dev-sign-last-tx: signing tx with %zu outputs", |
| 3828 | channel->last_tx->wtx->num_outputs); |
| 3829 | |
| 3830 | tx = sign_last_tx(cmd, channel, channel->last_tx, &channel->last_sig); |
| 3831 | json_add_tx(response, "tx", tx); |
| 3832 | |
| 3833 | /* If we've got inflights, return them */ |
| 3834 | if (!list_empty(&channel->inflights)) { |
| 3835 | struct channel_inflight *inflight; |
| 3836 | |
| 3837 | json_array_start(response, "inflights"); |
| 3838 | list_for_each(&channel->inflights, inflight, list) { |
| 3839 | if (inflight->splice_locked_memonly) |
| 3840 | continue; |
| 3841 | tx = sign_last_tx(cmd, channel, inflight->last_tx, |
| 3842 | &inflight->last_sig); |
| 3843 | json_object_start(response, NULL); |
| 3844 | json_add_txid(response, "funding_txid", |
| 3845 | &inflight->funding->outpoint.txid); |
| 3846 | json_add_tx(response, "tx", tx); |
| 3847 | json_object_end(response); |
| 3848 | } |
| 3849 | json_array_end(response); |
| 3850 | } |
| 3851 | |
| 3852 | return command_success(cmd, response); |
| 3853 | } |
| 3854 | |
| 3855 | static const struct json_command dev_sign_last_tx = { |
| 3856 | "dev-sign-last-tx", |
nothing calls this directly
no test coverage detected