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

Function handle_custommsg

connectd/multiplex.c:1009–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007}
1008
1009static bool handle_custommsg(struct daemon *daemon,
1010 struct peer *peer,
1011 const u8 *msg)
1012{
1013 enum peer_wire type = fromwire_peektype(msg);
1014
1015 /* Messages we expect to handle ourselves. */
1016 if (peer_wire_is_internal(type))
1017 return false;
1018
1019 /* We log it, since it's not going to a subdaemon */
1020 status_peer_io(LOG_IO_IN, &peer->id, msg);
1021
1022 /* Even unknown messages must be explicitly allowed */
1023 if (type % 2 == 0 && !find_custom_msg(daemon->custom_msgs, type)) {
1024 send_warning(peer, "Invalid unknown even msg %s",
1025 tal_hex(msg, msg));
1026 /* We "handled" it... */
1027 return true;
1028 }
1029
1030 /* The message is not part of the messages we know how to
1031 * handle. Assuming this is a custommsg, we just forward it to the
1032 * master. */
1033 daemon_conn_send(daemon->master,
1034 take(towire_connectd_custommsg_in(NULL,
1035 &peer->id,
1036 msg)));
1037 return true;
1038}
1039
1040void custommsg_completed(struct daemon *daemon, const u8 *msg)
1041{

Callers 1

handle_message_locallyFunction · 0.70

Calls 7

fromwire_peektypeFunction · 0.85
peer_wire_is_internalFunction · 0.85
find_custom_msgFunction · 0.85
send_warningFunction · 0.85
tal_hexFunction · 0.85
daemon_conn_sendFunction · 0.85
status_peer_ioFunction · 0.50

Tested by

no test coverage detected