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

Function recv_req

gossipd/gossipd.c:525–585  ·  view source on GitHub ↗

~ This routine handles all the commands from lightningd. */

Source from the content-addressed store, hash-verified

523
524/*~ This routine handles all the commands from lightningd. */
525static struct io_plan *recv_req(struct io_conn *conn,
526 const u8 *msg,
527 struct daemon *daemon)
528{
529 enum gossipd_wire t = fromwire_peektype(msg);
530
531 switch (t) {
532 case WIRE_GOSSIPD_INIT:
533 gossip_init(daemon, msg);
534 goto done;
535
536 case WIRE_GOSSIPD_GET_TXOUT_REPLY:
537 gossmap_manage_handle_get_txout_reply(daemon->gm, msg);
538 goto done;
539
540 case WIRE_GOSSIPD_OUTPOINTS_SPENT:
541 handle_outpoints_spent(daemon, msg);
542 goto done;
543
544 case WIRE_GOSSIPD_NEW_BLOCKHEIGHT:
545 new_blockheight(daemon, msg);
546 goto done;
547
548 case WIRE_GOSSIPD_ADDGOSSIP:
549 inject_gossip(daemon, msg);
550 goto done;
551
552 case WIRE_GOSSIPD_DEV_MEMLEAK:
553 if (daemon->developer) {
554 dev_gossip_memleak(daemon, msg);
555 goto done;
556 }
557 /* fall thru */
558 case WIRE_GOSSIPD_DEV_COMPACT_STORE:
559 if (daemon->developer) {
560 gossmap_manage_handle_dev_compact_store(daemon->gm, msg);
561 goto done;
562 }
563 /* fall thru */
564
565 /* We send these, we don't receive them */
566 case WIRE_GOSSIPD_INIT_CUPDATE:
567 case WIRE_GOSSIPD_INIT_NANNOUNCE:
568 case WIRE_GOSSIPD_INIT_REPLY:
569 case WIRE_GOSSIPD_GET_TXOUT:
570 case WIRE_GOSSIPD_DEV_MEMLEAK_REPLY:
571 case WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY:
572 case WIRE_GOSSIPD_ADDGOSSIP_REPLY:
573 case WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY:
574 case WIRE_GOSSIPD_REMOTE_CHANNEL_UPDATE:
575 case WIRE_GOSSIPD_CONNECT_TO_PEER:
576 break;
577 }
578
579 /* Master shouldn't give bad requests. */
580 status_failed(STATUS_FAIL_MASTER_IO, "%i: %s",
581 t, tal_hex(tmpctx, msg));
582

Callers

nothing calls this directly

Calls 11

fromwire_peektypeFunction · 0.85
handle_outpoints_spentFunction · 0.85
inject_gossipFunction · 0.85
dev_gossip_memleakFunction · 0.85
tal_hexFunction · 0.85
daemon_conn_read_nextFunction · 0.85
gossip_initFunction · 0.70
new_blockheightFunction · 0.70
status_failedFunction · 0.50

Tested by

no test coverage detected