gossmap: add (and use) logging hook.

Default goes to stderr for LOG_UNUSUAL and higher.

We have to whitelist more cases in map_catchup so we don't spam the logs
with perfectly-expected (but ignored) messages though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-02-10 12:18:40 +10:30
committed by Alex Myers
parent 607b14fe12
commit fdfc7ce62f
29 changed files with 191 additions and 186 deletions

View File

@@ -554,7 +554,7 @@ int main(int argc, char *argv[])
bool *dirs;
gzFile outf = gzdopen(outfd, "wb9");
struct gossmap *gossmap = gossmap_load(tmpctx, argv[2], NULL);
struct gossmap *gossmap = gossmap_load(tmpctx, argv[2], NULL, NULL);
if (!gossmap)
opt_usage_exit_fail(tal_fmt(tmpctx, "Cannot open %s for reading: %s",
argv[2], strerror(errno)));

View File

@@ -68,7 +68,6 @@ int main(int argc, char *argv[])
struct gossmap *map;
struct node_id dstid;
bool clean_topology = false;
size_t num_channel_updates_rejected;
common_setup(argv[0]);
@@ -83,14 +82,13 @@ int main(int argc, char *argv[])
opt_usage_exit_fail("Expect 3 arguments");
tstart = time_mono();
map = gossmap_load(NULL, argv[1], &num_channel_updates_rejected);
map = gossmap_load(NULL, argv[1], NULL, NULL);
if (!map)
err(1, "Loading gossip store %s", argv[1]);
tstop = time_mono();
printf("# Time to load: %"PRIu64" msec (%zu ignored)\n",
time_to_msec(timemono_between(tstop, tstart)),
num_channel_updates_rejected);
printf("# Time to load: %"PRIu64" msec\n",
time_to_msec(timemono_between(tstop, tstart)));
if (clean_topology)
clean_topo(map, false);

View File

@@ -256,7 +256,7 @@ int main(int argc, char *argv[])
opt_usage_exit_fail("Expect 3 arguments");
tstart = time_mono();
map = gossmap_load(NULL, argv[1], NULL);
map = gossmap_load(NULL, argv[1], NULL, NULL);
if (!map)
err(1, "Loading gossip store %s", argv[1]);
tstop = time_mono();