| 37 | } |
| 38 | |
| 39 | u8 *towire_warningfmtv(const tal_t *ctx, |
| 40 | const struct channel_id *channel, |
| 41 | const char *fmt, |
| 42 | va_list ap) |
| 43 | { |
| 44 | /* BOLT #1: |
| 45 | * |
| 46 | * The channel is referred to by `channel_id`, unless `channel_id` is |
| 47 | * 0 (i.e. all bytes are 0), in which case it refers to all |
| 48 | * channels. */ |
| 49 | static const struct channel_id all_channels; |
| 50 | char *estr; |
| 51 | u8 *msg; |
| 52 | |
| 53 | estr = tal_vfmt(ctx, fmt, ap); |
| 54 | /* We need tal_len to work, so we use copy. */ |
| 55 | msg = towire_warning(ctx, channel ? channel : &all_channels, |
| 56 | (u8 *)tal_dup_arr(estr, char, estr, strlen(estr), 0)); |
| 57 | tal_free(estr); |
| 58 | |
| 59 | return msg; |
| 60 | } |
| 61 | |
| 62 | u8 *towire_warningfmt(const tal_t *ctx, |
| 63 | const struct channel_id *channel, |
no test coverage detected