| 402 | } |
| 403 | |
| 404 | struct command_result *handle_invoice_onion_message(struct command *cmd, |
| 405 | const char *buf, |
| 406 | const jsmntok_t *om, |
| 407 | const struct secret *pathsecret) |
| 408 | { |
| 409 | struct sent *sent; |
| 410 | struct command_result *err; |
| 411 | |
| 412 | /* BOLT #4: |
| 413 | * - otherwise (it is the final node): |
| 414 | * - if `path_id` is set and corresponds to a path the reader has previously published in a `reply_path`: |
| 415 | * - if the onion message is not a reply to that previous onion: |
| 416 | * - MUST ignore the onion message |
| 417 | * - otherwise (unknown or unset `path_id`): |
| 418 | * - if the onion message is a reply to an onion message which contained a `path_id`: |
| 419 | * - MUST respond (or not respond) exactly as if it did not send the initial onion message. |
| 420 | */ |
| 421 | /* We unmarshal the path_id into our secret: if it is NULL or wrong, we exit here */ |
| 422 | sent = find_sent_by_secret(pathsecret); |
| 423 | if (!sent) |
| 424 | return NULL; |
| 425 | |
| 426 | plugin_log(cmd->plugin, LOG_DBG, "Received onion message reply for invoice_request: %.*s", |
| 427 | json_tok_full_len(om), |
| 428 | json_tok_full(buf, om)); |
| 429 | |
| 430 | err = handle_error(cmd, sent, buf, om); |
| 431 | if (err) |
| 432 | return err; |
| 433 | |
| 434 | if (sent->invreq) |
| 435 | return handle_invreq_response(cmd, sent, buf, om); |
| 436 | |
| 437 | return NULL; |
| 438 | } |
| 439 | |
| 440 | static void destroy_sent(struct sent *sent) |
| 441 | { |
no test coverage detected