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:
committed by
Alex Myers
parent
607b14fe12
commit
fdfc7ce62f
@@ -407,13 +407,26 @@ static void start_prune_timer(struct gossmap_manage *gm)
|
||||
|
||||
static void reprocess_queued_msgs(struct gossmap_manage *gm);
|
||||
|
||||
static void gossmap_logcb(struct daemon *daemon,
|
||||
enum log_level level,
|
||||
const char *fmt,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
status_vfmt(level, NULL, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
struct gossmap_manage *gossmap_manage_new(const tal_t *ctx,
|
||||
struct daemon *daemon,
|
||||
struct chan_dying *dying_channels TAKES)
|
||||
{
|
||||
struct gossmap_manage *gm = tal(ctx, struct gossmap_manage);
|
||||
|
||||
gm->raw_gossmap = gossmap_load(gm, GOSSIP_STORE_FILENAME, NULL);
|
||||
gm->raw_gossmap = gossmap_load(gm, GOSSIP_STORE_FILENAME,
|
||||
gossmap_logcb, daemon);
|
||||
assert(gm->raw_gossmap);
|
||||
gm->daemon = daemon;
|
||||
|
||||
@@ -1309,7 +1322,7 @@ void gossmap_manage_channel_spent(struct gossmap_manage *gm,
|
||||
|
||||
struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm)
|
||||
{
|
||||
gossmap_refresh(gm->raw_gossmap, NULL);
|
||||
gossmap_refresh(gm->raw_gossmap);
|
||||
return gm->raw_gossmap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user