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

Function main

plugins/sql.c:2197–2232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2195}
2196
2197int main(int argc, char *argv[])
2198{
2199 struct sql *sql;
2200 setup_locale();
2201
2202 if (argc == 2 && streq(argv[1], "--print-docs")) {
2203 tablemap tablemap;
2204 common_setup(argv[0]);
2205
2206 /* plugin is NULL, so just sets up tables */
2207 init_tablemap(NULL, &tablemap);
2208
2209 printf("The following tables are currently supported:\n");
2210 strmap_iterate(&tablemap, print_one_table, NULL);
2211 common_shutdown();
2212 return 0;
2213 }
2214
2215 sql = tal(NULL, struct sql);
2216 sql->dbfilename = NULL;
2217 sql->gosstore_fd = -1;
2218 sql->gosstore_nodes_off = sql->gosstore_channels_off = 0;
2219 sql->next_rowid = 1;
2220 sql->limit_per_list = 10000;
2221 plugin_main(argv, init, take(sql), PLUGIN_RESTARTABLE, true, NULL, commands, ARRAY_SIZE(commands),
2222 NULL, 0, NULL, 0, NULL, 0,
2223 plugin_option_dev("dev-sqlfilename",
2224 "string",
2225 "Use on-disk sqlite3 file instead of in memory (e.g. debugging)",
2226 charp_option, NULL, &sql->dbfilename),
2227 plugin_option_dev("dev-sqllistlimit",
2228 "int",
2229 "A variable setting for how many chainmoves/channelmoves we fetch at once",
2230 u32_option, NULL, &sql->limit_per_list),
2231 NULL);
2232}

Callers

nothing calls this directly

Calls 5

setup_localeFunction · 0.85
common_setupFunction · 0.85
init_tablemapFunction · 0.85
common_shutdownFunction · 0.85
plugin_mainFunction · 0.70

Tested by

no test coverage detected