| 44 | } |
| 45 | |
| 46 | static void onion_message_serialize(struct onion_message_hook_payload *payload, |
| 47 | struct json_stream *stream, |
| 48 | struct plugin *plugin) |
| 49 | { |
| 50 | json_object_start(stream, "onion_message"); |
| 51 | if (payload->our_alias) |
| 52 | json_add_pubkey(stream, "our_alias", payload->our_alias); |
| 53 | |
| 54 | if (payload->reply_first_node) { |
| 55 | json_add_blindedpath(stream, "reply_blindedpath", |
| 56 | payload->reply_blinding, |
| 57 | payload->reply_first_node, |
| 58 | payload->reply_path); |
| 59 | } |
| 60 | |
| 61 | if (payload->om->invoice_request) |
| 62 | json_add_hex_talarr(stream, "invoice_request", |
| 63 | payload->om->invoice_request); |
| 64 | if (payload->om->invoice) |
| 65 | json_add_hex_talarr(stream, "invoice", payload->om->invoice); |
| 66 | |
| 67 | if (payload->om->invoice_error) |
| 68 | json_add_hex_talarr(stream, "invoice_error", |
| 69 | payload->om->invoice_error); |
| 70 | |
| 71 | json_array_start(stream, "unknown_fields"); |
| 72 | for (size_t i = 0; i < tal_count(payload->om->fields); i++) { |
| 73 | if (payload->om->fields[i].meta) |
| 74 | continue; |
| 75 | json_object_start(stream, NULL); |
| 76 | json_add_u64(stream, "number", payload->om->fields[i].numtype); |
| 77 | json_add_hex(stream, "value", |
| 78 | payload->om->fields[i].value, |
| 79 | payload->om->fields[i].length); |
| 80 | json_object_end(stream); |
| 81 | } |
| 82 | json_array_end(stream); |
| 83 | |
| 84 | json_object_end(stream); |
| 85 | } |
| 86 | |
| 87 | static void |
| 88 | onion_message_hook_cb(struct onion_message_hook_payload *payload STEALS) |
nothing calls this directly
no test coverage detected