| 407 | } |
| 408 | |
| 409 | static struct command_result *recv_modern_onion_message(struct command *cmd, |
| 410 | const char *buf, |
| 411 | const jsmntok_t *params) |
| 412 | { |
| 413 | const jsmntok_t *om, *aliastok; |
| 414 | struct sent *sent; |
| 415 | struct pubkey alias; |
| 416 | struct command_result *err; |
| 417 | |
| 418 | om = json_get_member(buf, params, "onion_message"); |
| 419 | |
| 420 | aliastok = json_get_member(buf, om, "our_alias"); |
| 421 | if (!aliastok || !json_to_pubkey(buf, aliastok, &alias)) |
| 422 | return command_hook_success(cmd); |
| 423 | |
| 424 | sent = find_sent_by_alias(&alias); |
| 425 | if (!sent) { |
| 426 | plugin_log(cmd->plugin, LOG_DBG, |
| 427 | "No match for modern onion %.*s", |
| 428 | json_tok_full_len(om), |
| 429 | json_tok_full(buf, om)); |
| 430 | return command_hook_success(cmd); |
| 431 | } |
| 432 | |
| 433 | plugin_log(cmd->plugin, LOG_DBG, "Received modern onion message: %.*s", |
| 434 | json_tok_full_len(params), |
| 435 | json_tok_full(buf, params)); |
| 436 | |
| 437 | err = handle_error(cmd, sent, buf, om); |
| 438 | if (err) |
| 439 | return err; |
| 440 | |
| 441 | if (sent->invreq) |
| 442 | return handle_invreq_response(cmd, sent, buf, om); |
| 443 | |
| 444 | return command_hook_success(cmd); |
| 445 | } |
| 446 | |
| 447 | static void destroy_sent(struct sent *sent) |
| 448 | { |
nothing calls this directly
no test coverage detected