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