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

Function connect_init

connectd/connectd.c:1665–1772  ·  view source on GitHub ↗

~ Parse the incoming connect init message from lightningd ("master") and * assign config variables to the daemon; it should be the first message we * get. */

Source from the content-addressed store, hash-verified

1663 * assign config variables to the daemon; it should be the first message we
1664 * get. */
1665static void connect_init(struct daemon *daemon, const u8 *msg)
1666{
1667 struct wireaddr *proxyaddr;
1668 struct wireaddr_internal *binding;
1669 struct wireaddr_internal *proposed_wireaddr;
1670 enum addr_listen_announce *proposed_listen_announce;
1671 struct wireaddr *announceable;
1672 char *tor_password;
1673 bool dev_disconnect, dev_throttle_gossip, dev_limit_connections_inflight;
1674 char *errstr;
1675
1676 /* Fields which require allocation are allocated off daemon */
1677 if (!fromwire_connectd_init(daemon, msg,
1678 &chainparams,
1679 &daemon->our_features,
1680 &daemon->id,
1681 &proposed_wireaddr,
1682 &proposed_listen_announce,
1683 &proxyaddr,
1684 &daemon->always_use_proxy,
1685 &daemon->dev_allow_localhost,
1686 &daemon->use_dns,
1687 &tor_password,
1688 &daemon->timeout_secs,
1689 &daemon->websocket_helper,
1690 &daemon->message_padding,
1691 &daemon->dev_fast_gossip,
1692 &dev_disconnect,
1693 &daemon->dev_no_ping_timer,
1694 &daemon->dev_handshake_no_reply,
1695 &dev_throttle_gossip,
1696 &daemon->dev_no_reconnect,
1697 &daemon->dev_fast_reconnect,
1698 &dev_limit_connections_inflight,
1699 &daemon->dev_keep_nagle)) {
1700 /* This is a helper which prints the type expected and the actual
1701 * message, then exits (it should never be called!). */
1702 master_badmsg(WIRE_CONNECTD_INIT, msg);
1703 }
1704
1705 if (!pubkey_from_node_id(&daemon->mykey, &daemon->id))
1706 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1707 "Invalid id for me %s",
1708 fmt_node_id(tmpctx, &daemon->id));
1709
1710 /* Resolve Tor proxy address if any: we need an addrinfo to connect()
1711 * to. */
1712 if (proxyaddr) {
1713 status_debug("Proxy address: %s",
1714 fmt_wireaddr(tmpctx, proxyaddr));
1715 daemon->proxyaddr = wireaddr_to_addrinfo(daemon, proxyaddr);
1716 tal_free(proxyaddr);
1717 } else
1718 daemon->proxyaddr = NULL;
1719
1720 /* Figure out our addresses. */
1721 daemon->listen_fds = setup_listeners(daemon, daemon,
1722 proposed_wireaddr,

Callers 1

recv_reqFunction · 0.85

Calls 11

fmt_node_idFunction · 0.85
fmt_wireaddrFunction · 0.85
wireaddr_to_addrinfoFunction · 0.85
tal_freeFunction · 0.85
setup_listenersFunction · 0.85
daemon_conn_sendFunction · 0.85
dev_disconnect_initFunction · 0.85
master_badmsgFunction · 0.50
pubkey_from_node_idFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected