| 214 | }; |
| 215 | |
| 216 | static struct command_result *check_result(struct command *cmd, |
| 217 | const char *method, |
| 218 | const char *buf, |
| 219 | const jsmntok_t *result, |
| 220 | void *arg UNNEEDED) |
| 221 | { |
| 222 | bool active; |
| 223 | |
| 224 | /* If it's inactive, we can't return it, */ |
| 225 | if (!json_to_bool(buf, json_get_member(buf, result, "active"), |
| 226 | &active)) { |
| 227 | return command_fail(cmd, |
| 228 | LIGHTNINGD, |
| 229 | "Bad createoffer/createinvoicerequest status reply %.*s", |
| 230 | json_tok_full_len(result), |
| 231 | json_tok_full(buf, result)); |
| 232 | } |
| 233 | if (!active) |
| 234 | return command_fail(cmd, |
| 235 | OFFER_ALREADY_EXISTS, |
| 236 | "Already exists, but isn't active"); |
| 237 | |
| 238 | /* Otherwise, push through the result. */ |
| 239 | return forward_result(cmd, method, buf, result, arg); |
| 240 | } |
| 241 | |
| 242 | static struct command_result *create_offer(struct command *cmd, |
| 243 | struct offer_info *offinfo) |
nothing calls this directly
no test coverage detected