MCPcopy Create free account
hub / github.com/ElementsProject/lightning / recv_modern_onion_message

Function recv_modern_onion_message

plugins/fetchinvoice.c:409–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409static 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
447static void destroy_sent(struct sent *sent)
448{

Callers

nothing calls this directly

Calls 9

command_hook_successFunction · 0.85
find_sent_by_aliasFunction · 0.85
handle_errorFunction · 0.85
handle_invreq_responseFunction · 0.85
plugin_logFunction · 0.70
json_get_memberFunction · 0.50
json_to_pubkeyFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected