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

Function connect_init

connectd/connectd.c:1428–1529  ·  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

1426 * assign config variables to the daemon; it should be the first message we
1427 * get. */
1428static void connect_init(struct daemon *daemon, const u8 *msg)
1429{
1430 struct wireaddr *proxyaddr;
1431 struct wireaddr_internal *binding;
1432 struct wireaddr_internal *proposed_wireaddr;
1433 enum addr_listen_announce *proposed_listen_announce;
1434 struct wireaddr *announceable;
1435 char *tor_password;
1436 bool dev_fast_gossip;
1437 bool dev_disconnect, dev_no_ping_timer;
1438 char *errstr;
1439
1440 /* Fields which require allocation are allocated off daemon */
1441 if (!fromwire_connectd_init(
1442 daemon, msg,
1443 &chainparams,
1444 &daemon->our_features,
1445 &daemon->id,
1446 &proposed_wireaddr,
1447 &proposed_listen_announce,
1448 &proxyaddr, &daemon->always_use_proxy,
1449 &daemon->dev_allow_localhost, &daemon->use_dns,
1450 &tor_password,
1451 &daemon->timeout_secs,
1452 &daemon->websocket_helper,
1453 &daemon->websocket_port,
1454 &daemon->announce_websocket,
1455 &dev_fast_gossip,
1456 &dev_disconnect,
1457 &dev_no_ping_timer)) {
1458 /* This is a helper which prints the type expected and the actual
1459 * message, then exits (it should never be called!). */
1460 master_badmsg(WIRE_CONNECTD_INIT, msg);
1461 }
1462
1463#if DEVELOPER
1464 /*~ Clearly mark these as developer-only flags! */
1465 daemon->dev_fast_gossip = dev_fast_gossip;
1466 daemon->dev_no_ping_timer = dev_no_ping_timer;
1467 daemon->dev_suppress_gossip = false;
1468#endif
1469
1470 if (!pubkey_from_node_id(&daemon->mykey, &daemon->id))
1471 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1472 "Invalid id for me %s",
1473 type_to_string(tmpctx, struct node_id,
1474 &daemon->id));
1475
1476 /* Resolve Tor proxy address if any: we need an addrinfo to connect()
1477 * to. */
1478 if (proxyaddr) {
1479 status_debug("Proxy address: %s",
1480 fmt_wireaddr(tmpctx, proxyaddr));
1481 daemon->proxyaddr = wireaddr_to_addrinfo(daemon, proxyaddr);
1482 tal_free(proxyaddr);
1483 } else
1484 daemon->proxyaddr = NULL;
1485

Callers 1

recv_reqFunction · 0.85

Calls 11

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

Tested by

no test coverage detected