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

Function connect_init

connectd/connectd.c:1668–1779  ·  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

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