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