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

Function handle_message_locally

connectd/multiplex.c:740–770  ·  view source on GitHub ↗

We handle pings and gossip messages. */

Source from the content-addressed store, hash-verified

738
739/* We handle pings and gossip messages. */
740static bool handle_message_locally(struct peer *peer, const u8 *msg)
741{
742 enum peer_wire type = fromwire_peektype(msg);
743
744 /* We remember these so we don't rexmit them */
745 gossip_rcvd_filter_add(peer->gs.grf, msg);
746
747 if (type == WIRE_GOSSIP_TIMESTAMP_FILTER) {
748 handle_gossip_timestamp_filter_in(peer, msg);
749 return true;
750 } else if (type == WIRE_PING) {
751 handle_ping_in(peer, msg);
752 return true;
753 } else if (type == WIRE_PONG) {
754 handle_pong_in(peer, msg);
755 return true;
756 } else if (type == WIRE_ONION_MESSAGE) {
757 handle_onion_message(peer->daemon, peer, msg);
758 return true;
759 } else if (handle_custommsg(peer->daemon, peer, msg)) {
760 return true;
761 }
762
763 /* Do we want to divert to gossipd? */
764 if (is_msg_for_gossipd(msg)) {
765 handle_gossip_in(peer, msg);
766 return true;
767 }
768
769 return false;
770}
771
772/* Move "channel_id" to temporary. */
773static void move_channel_id_to_temp(struct subd *subd)

Callers 1

read_body_from_peer_doneFunction · 0.85

Calls 9

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

Tested by

no test coverage detected