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

Function handle_message_locally

connectd/multiplex.c:1057–1097  ·  view source on GitHub ↗

We handle pings and gossip messages. */

Source from the content-addressed store, hash-verified

1055
1056/* We handle pings and gossip messages. */
1057static bool handle_message_locally(struct peer *peer, const u8 *msg)
1058{
1059 enum peer_wire type = fromwire_peektype(msg);
1060
1061 /* We remember these so we don't rexmit them */
1062 gossip_rcvd_filter_add(peer->gs.grf, msg);
1063
1064 if (type == WIRE_GOSSIP_TIMESTAMP_FILTER) {
1065 log_peer_io(peer, msg);
1066 handle_gossip_timestamp_filter_in(peer, msg);
1067 return true;
1068 } else if (type == WIRE_PING) {
1069 log_peer_io(peer, msg);
1070 handle_ping_in(peer, msg);
1071 return true;
1072 } else if (type == WIRE_PONG) {
1073 log_peer_io(peer, msg);
1074 handle_pong_in(peer, msg);
1075 return true;
1076 } else if (type == WIRE_ONION_MESSAGE) {
1077 log_peer_io(peer, msg);
1078 handle_onion_message(peer->daemon, peer, msg);
1079 return true;
1080 } else if (type == WIRE_QUERY_CHANNEL_RANGE) {
1081 handle_query_channel_range(peer, msg);
1082 return true;
1083 } else if (type == WIRE_QUERY_SHORT_CHANNEL_IDS) {
1084 handle_query_short_channel_ids(peer, msg);
1085 return true;
1086 } else if (handle_custommsg(peer->daemon, peer, msg)) {
1087 return true;
1088 }
1089
1090 /* Do we want to divert to gossipd? */
1091 if (is_msg_for_gossipd(msg)) {
1092 handle_gossip_in(peer, msg);
1093 return true;
1094 }
1095
1096 return false;
1097}
1098
1099/* Move "channel_id" to temporary. */
1100static 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