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

Function connect_init

connectd/connectd.c:1716–1827  ·  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

1714 * assign config variables to the daemon; it should be the first message we
1715 * get. */
1716static void connect_init(struct daemon *daemon, const u8 *msg)
1717{
1718 struct wireaddr *proxyaddr;
1719 struct wireaddr_internal *binding;
1720 struct wireaddr_internal *proposed_wireaddr;
1721 enum addr_listen_announce *proposed_listen_announce;
1722 struct wireaddr *announceable;
1723 char *tor_password;
1724 bool dev_disconnect, dev_throttle_gossip, dev_limit_connections_inflight;
1725 char *errstr;
1726
1727 /* Fields which require allocation are allocated off daemon */
1728 if (!fromwire_connectd_init(daemon, msg,
1729 &chainparams,
1730 &daemon->our_features,
1731 &daemon->id,
1732 &proposed_wireaddr,
1733 &proposed_listen_announce,
1734 &proxyaddr,
1735 &daemon->always_use_proxy,
1736 &daemon->dev_allow_localhost,
1737 &daemon->use_dns,
1738 &tor_password,
1739 &daemon->timeout_secs,
1740 &daemon->websocket_helper,
1741 &daemon->message_padding,
1742 &daemon->dev_fast_gossip,
1743 &dev_disconnect,
1744 &daemon->dev_no_ping_timer,
1745 &daemon->dev_handshake_no_reply,
1746 &dev_throttle_gossip,
1747 &daemon->dev_no_reconnect,
1748 &daemon->dev_fast_reconnect,
1749 &dev_limit_connections_inflight,
1750 &daemon->dev_keep_nagle)) {
1751 /* This is a helper which prints the type expected and the actual
1752 * message, then exits (it should never be called!). */
1753 master_badmsg(WIRE_CONNECTD_INIT, msg);
1754 }
1755
1756 if (!pubkey_from_node_id(&daemon->mykey, &daemon->id))
1757 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1758 "Invalid id for me %s",
1759 fmt_node_id(tmpctx, &daemon->id));
1760
1761 /* Resolve Tor proxy address if any: we need an addrinfo to connect()
1762 * to. */
1763 if (proxyaddr) {
1764 status_debug("Proxy address: %s",
1765 fmt_wireaddr(tmpctx, proxyaddr));
1766 daemon->proxyaddr = wireaddr_to_addrinfo(daemon, proxyaddr);
1767 tal_free(proxyaddr);
1768 } else
1769 daemon->proxyaddr = NULL;
1770
1771 /* Figure out our addresses. */
1772 daemon->listen_fds = setup_listeners(daemon, daemon,
1773 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