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

Function main

hsmd/hsmd.c:867–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865}
866
867int main(int argc, char *argv[])
868{
869 struct client *master;
870
871 setup_locale();
872
873 /* This sets up tmpctx, various --developer options, backtraces, etc. */
874 developer = subdaemon_setup(argc, argv);
875
876 /* A trivial daemon_conn just for writing. */
877 status_conn = daemon_conn_new(NULL, STDIN_FILENO, NULL, NULL, NULL);
878 status_setup_async(status_conn);
879 uintmap_init(&clients);
880
881 master = new_client(NULL, NULL, NULL, 0,
882 HSM_PERM_MASTER | HSM_PERM_SIGN_GOSSIP | HSM_PERM_ECDH,
883 REQ_FD);
884
885 /* First client == lightningd. */
886 assert(is_lightningd(master));
887
888 /* When conn closes, everything is freed. */
889 io_set_finish(master->conn, master_gone, master);
890
891 /*~ The two NULL args are a list of timers, and the timer which expired:
892 * we don't have any timers. */
893 io_loop(NULL, NULL);
894
895 /*~ This should never be reached: io_loop only exits on io_break which
896 * we don't call, a timer expiry which we don't have, or all connections
897 * being closed, and closing the master calls master_gone. */
898 abort();
899}
900
901/*~ Congratulations on making it through the first of the seven dwarves!
902 * (And Christian wondered why I'm so fond of having separate daemons!).

Callers

nothing calls this directly

Calls 7

setup_localeFunction · 0.85
status_setup_asyncFunction · 0.85
new_clientFunction · 0.85
is_lightningdFunction · 0.85
io_loopFunction · 0.85
abortFunction · 0.85
subdaemon_setupFunction · 0.50

Tested by

no test coverage detected