Resolve a close command for a channel that will be closed soon: returns * the cmd_id of one, if any (allocated off ctx). */
| 72 | /* Resolve a close command for a channel that will be closed soon: returns |
| 73 | * the cmd_id of one, if any (allocated off ctx). */ |
| 74 | const char *resolve_close_command(const tal_t *ctx, |
| 75 | struct lightningd *ld, struct channel *channel, |
| 76 | bool cooperative) |
| 77 | { |
| 78 | struct close_command *cc; |
| 79 | struct close_command *n; |
| 80 | const char *cmd_id = NULL; |
| 81 | |
| 82 | list_for_each_safe(&ld->close_commands, cc, n, list) { |
| 83 | if (cc->channel != channel) |
| 84 | continue; |
| 85 | if (!cmd_id) |
| 86 | cmd_id = tal_strdup(ctx, cc->cmd->id); |
| 87 | resolve_one_close_command(cc, cooperative); |
| 88 | } |
| 89 | return cmd_id; |
| 90 | } |
| 91 | |
| 92 | /* Destroy the close command structure in reaction to the |
| 93 | * channel being destroyed. */ |
no test coverage detected