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

Function handle_message_locally

connectd/multiplex.c:961–1001  ·  view source on GitHub ↗

We handle pings and gossip messages. */

Source from the content-addressed store, hash-verified

959
960/* We handle pings and gossip messages. */
961static bool handle_message_locally(struct peer *peer, const u8 *msg)
962{
963 enum peer_wire type = fromwire_peektype(msg);
964
965 /* We remember these so we don't rexmit them */
966 gossip_rcvd_filter_add(peer->gs.grf, msg);
967
968 if (type == WIRE_GOSSIP_TIMESTAMP_FILTER) {
969 log_peer_io(peer, msg);
970 handle_gossip_timestamp_filter_in(peer, msg);
971 return true;
972 } else if (type == WIRE_PING) {
973 log_peer_io(peer, msg);
974 handle_ping_in(peer, msg);
975 return true;
976 } else if (type == WIRE_PONG) {
977 log_peer_io(peer, msg);
978 handle_pong_in(peer, msg);
979 return true;
980 } else if (type == WIRE_ONION_MESSAGE) {
981 log_peer_io(peer, msg);
982 handle_onion_message(peer->daemon, peer, msg);
983 return true;
984 } else if (type == WIRE_QUERY_CHANNEL_RANGE) {
985 handle_query_channel_range(peer, msg);
986 return true;
987 } else if (type == WIRE_QUERY_SHORT_CHANNEL_IDS) {
988 handle_query_short_channel_ids(peer, msg);
989 return true;
990 } else if (handle_custommsg(peer->daemon, peer, msg)) {
991 return true;
992 }
993
994 /* Do we want to divert to gossipd? */
995 if (is_msg_for_gossipd(msg)) {
996 handle_gossip_in(peer, msg);
997 return true;
998 }
999
1000 return false;
1001}
1002
1003/* Move "channel_id" to temporary. */
1004static void move_channel_id_to_temp(struct subd *subd)

Callers 1

read_body_from_peer_doneFunction · 0.85

Calls 12

fromwire_peektypeFunction · 0.85
gossip_rcvd_filter_addFunction · 0.85
log_peer_ioFunction · 0.85
handle_ping_inFunction · 0.85
handle_pong_inFunction · 0.85
handle_onion_messageFunction · 0.85
is_msg_for_gossipdFunction · 0.85
handle_gossip_inFunction · 0.85
handle_custommsgFunction · 0.70

Tested by

no test coverage detected