~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* * To collect signatures from our peers, we use a notification watcher. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* */
| 325 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* |
| 326 | */ |
| 327 | static struct command_result * |
| 328 | openchannel_finished(struct multifundchannel_command *mfc) |
| 329 | { |
| 330 | for (size_t i = 0; i < tal_count(mfc->destinations); i++) { |
| 331 | struct multifundchannel_destination *dest; |
| 332 | dest = &mfc->destinations[i]; |
| 333 | |
| 334 | /* If there's a single failure, we have to |
| 335 | * return the failure to the user. */ |
| 336 | if (dest->state == MULTIFUNDCHANNEL_FAILED) { |
| 337 | struct json_stream *out; |
| 338 | |
| 339 | plugin_log(mfc->cmd->plugin, LOG_DBG, |
| 340 | "mfc %"PRIu64": %u failed, failing.", |
| 341 | mfc->id, dest->index); |
| 342 | |
| 343 | out = jsonrpc_stream_fail_data(mfc->cmd, |
| 344 | dest->error_code, |
| 345 | dest->error_message); |
| 346 | json_add_node_id(out, "id", &dest->id); |
| 347 | json_add_string(out, "method", "openchannel_signed"); |
| 348 | if (dest->error_data) |
| 349 | json_add_jsonstr(out, "data", |
| 350 | dest->error_data, |
| 351 | strlen(dest->error_data)); |
| 352 | json_object_end(out); |
| 353 | |
| 354 | return mfc_finished(mfc, out); |
| 355 | } |
| 356 | } |
| 357 | mfc->psbt = tal_free(mfc->psbt); |
| 358 | return multifundchannel_finished(mfc); |
| 359 | } |
| 360 | |
| 361 | static struct command_result * |
| 362 | after_openchannel_signed(struct multifundchannel_command *mfc) |
no test coverage detected