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

Function main

tests/plugins/channeld_fakenet.c:1270–1317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1268}
1269
1270int main(int argc, char *argv[])
1271{
1272 struct info *info;
1273
1274 setup_locale();
1275
1276 subdaemon_setup(argc, argv);
1277 info = tal(NULL, struct info);
1278
1279 info->dc = daemon_conn_new(info, MASTER_FD,
1280 recv_req, NULL, info);
1281 tal_add_destructor(info->dc, master_gone);
1282
1283 status_setup_async(info->dc);
1284
1285 info->gossmap = gossmap_load(info, GOSSIP_STORE_FILENAME, NULL, NULL);
1286 if (!info->gossmap)
1287 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1288 "Loading gossmap %s", strerror(errno));
1289
1290 info->node_map = tal(info, struct node_map);
1291 node_map_init(info->node_map);
1292 populate_node_map(info->gossmap, info->node_map);
1293 info->peer = make_peer_node(info);
1294 info->multi_payments = tal_arr(info, struct multi_payment *, 0);
1295 info->reservations = tal_arr(info, struct reservation *, 0);
1296 timers_init(&info->timers, time_mono());
1297 info->commit_num = 1;
1298 info->fakesig.sighash_type = SIGHASH_ALL;
1299 memset(&info->fakesig.s, 0, sizeof(info->fakesig.s));
1300 memset(&info->seed, 0, sizeof(info->seed));
1301
1302 if (getenv("CHANNELD_FAKENET_SEED"))
1303 info->seed.u.u64[0] = atol(getenv("CHANNELD_FAKENET_SEED"));
1304
1305 status_debug("channeld_fakenet seed is %"PRIu64, info->seed.u.u64[0]);
1306
1307 /* This loop never exits. io_loop() only returns if a timer has
1308 * expired, or io_break() is called, or all fds are closed. We don't
1309 * use io_break and closing the lightningd fd calls master_gone()
1310 * which exits. */
1311 for (;;) {
1312 struct timer *expired = NULL;
1313 io_loop(&info->timers, &expired);
1314
1315 timer_expired(expired);
1316 }
1317}

Callers

nothing calls this directly

Calls 10

setup_localeFunction · 0.85
status_setup_asyncFunction · 0.85
populate_node_mapFunction · 0.85
make_peer_nodeFunction · 0.85
timers_initFunction · 0.85
time_monoFunction · 0.85
io_loopFunction · 0.85
timer_expiredFunction · 0.85
subdaemon_setupFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected