| 169 | } |
| 170 | |
| 171 | void json_add_reservations(struct json_stream *js, |
| 172 | const struct reserve_htable *reserved, |
| 173 | const char *fieldname, |
| 174 | const struct layer **layers) |
| 175 | { |
| 176 | struct reserve *r; |
| 177 | struct reserve_htable_iter rit; |
| 178 | |
| 179 | json_array_start(js, fieldname); |
| 180 | for (r = reserve_htable_first(reserved, &rit); |
| 181 | r; |
| 182 | r = reserve_htable_next(reserved, &rit)) { |
| 183 | if (r->rhop.layer && !layer_in(r->rhop.layer, layers)) |
| 184 | continue; |
| 185 | json_object_start(js, NULL); |
| 186 | json_add_short_channel_id_dir(js, |
| 187 | "short_channel_id_dir", |
| 188 | r->rhop.scidd); |
| 189 | json_add_amount_msat(js, |
| 190 | "amount_msat", |
| 191 | r->rhop.amount); |
| 192 | json_add_u64(js, "age_in_seconds", |
| 193 | timemono_between(time_mono(), r->timestamp).ts.tv_sec); |
| 194 | json_add_string(js, "command_id", r->cmd_id); |
| 195 | json_object_end(js); |
| 196 | } |
| 197 | json_array_end(js); |
| 198 | } |
| 199 | |
| 200 | const char *fmt_reservations(const tal_t *ctx, |
| 201 | const struct reserve_htable *reserved, |
no test coverage detected