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

Function handle_custommsg

connectd/multiplex.c:913–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913static bool handle_custommsg(struct daemon *daemon,
914 struct peer *peer,
915 const u8 *msg)
916{
917 enum peer_wire type = fromwire_peektype(msg);
918
919 /* Messages we expect to handle ourselves. */
920 if (peer_wire_is_internal(type))
921 return false;
922
923 /* We log it, since it's not going to a subdaemon */
924 status_peer_io(LOG_IO_IN, &peer->id, msg);
925
926 /* Even unknown messages must be explicitly allowed */
927 if (type % 2 == 0 && !find_custom_msg(daemon->custom_msgs, type)) {
928 send_warning(peer, "Invalid unknown even msg %s",
929 tal_hex(msg, msg));
930 /* We "handled" it... */
931 return true;
932 }
933
934 /* The message is not part of the messages we know how to
935 * handle. Assuming this is a custommsg, we just forward it to the
936 * master. */
937 daemon_conn_send(daemon->master,
938 take(towire_connectd_custommsg_in(NULL,
939 &peer->id,
940 msg)));
941 return true;
942}
943
944void custommsg_completed(struct daemon *daemon, const u8 *msg)
945{

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