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

Function handle_message_locally

connectd/multiplex.c:1031–1071  ·  view source on GitHub ↗

We handle pings and gossip messages. */

Source from the content-addressed store, hash-verified

1029
1030/* We handle pings and gossip messages. */
1031static bool handle_message_locally(struct peer *peer, const u8 *msg)
1032{
1033 enum peer_wire type = fromwire_peektype(msg);
1034
1035 /* We remember these so we don't rexmit them */
1036 gossip_rcvd_filter_add(peer->gs.grf, msg);
1037
1038 if (type == WIRE_GOSSIP_TIMESTAMP_FILTER) {
1039 log_peer_io(peer, msg);
1040 handle_gossip_timestamp_filter_in(peer, msg);
1041 return true;
1042 } else if (type == WIRE_PING) {
1043 log_peer_io(peer, msg);
1044 handle_ping_in(peer, msg);
1045 return true;
1046 } else if (type == WIRE_PONG) {
1047 log_peer_io(peer, msg);
1048 handle_pong_in(peer, msg);
1049 return true;
1050 } else if (type == WIRE_ONION_MESSAGE) {
1051 log_peer_io(peer, msg);
1052 handle_onion_message(peer->daemon, peer, msg);
1053 return true;
1054 } else if (type == WIRE_QUERY_CHANNEL_RANGE) {
1055 handle_query_channel_range(peer, msg);
1056 return true;
1057 } else if (type == WIRE_QUERY_SHORT_CHANNEL_IDS) {
1058 handle_query_short_channel_ids(peer, msg);
1059 return true;
1060 } else if (handle_custommsg(peer->daemon, peer, msg)) {
1061 return true;
1062 }
1063
1064 /* Do we want to divert to gossipd? */
1065 if (is_msg_for_gossipd(msg)) {
1066 handle_gossip_in(peer, msg);
1067 return true;
1068 }
1069
1070 return false;
1071}
1072
1073/* Move "channel_id" to temporary. */
1074static 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