| 258 | }; |
| 259 | |
| 260 | static struct command_result *check_result(struct command *cmd, |
| 261 | const char *buf, |
| 262 | const jsmntok_t *result, |
| 263 | void *arg UNNEEDED) |
| 264 | { |
| 265 | bool active; |
| 266 | |
| 267 | /* If it's inactive, we can't return it, */ |
| 268 | if (!json_to_bool(buf, json_get_member(buf, result, "active"), |
| 269 | &active)) { |
| 270 | return command_fail(cmd, |
| 271 | LIGHTNINGD, |
| 272 | "Bad creaoffer status reply %.*s", |
| 273 | json_tok_full_len(result), |
| 274 | json_tok_full(buf, result)); |
| 275 | } |
| 276 | if (!active) |
| 277 | return command_fail(cmd, |
| 278 | OFFER_ALREADY_EXISTS, |
| 279 | "Offer already exists, but isn't active"); |
| 280 | |
| 281 | /* Otherwise, push through the result. */ |
| 282 | return forward_result(cmd, buf, result, arg); |
| 283 | } |
| 284 | |
| 285 | static struct command_result *create_offer(struct command *cmd, |
| 286 | struct offer_info *offinfo) |
nothing calls this directly
no test coverage detected