mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
plugins/topology: use memleak annotation instead of global_gossmap hammer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
a0d531d515
commit
127539a993
@@ -684,6 +684,14 @@ done:
|
||||
return command_finished(cmd, js);
|
||||
}
|
||||
|
||||
#if DEVELOPER
|
||||
static void memleak_mark(struct plugin *p, struct htable *memtable)
|
||||
{
|
||||
memleak_remove_region(memtable, global_gossmap,
|
||||
tal_bytelen(global_gossmap));
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *init(struct plugin *p,
|
||||
const char *buf UNUSED, const jsmntok_t *config UNUSED)
|
||||
{
|
||||
@@ -694,9 +702,9 @@ static const char *init(struct plugin *p,
|
||||
take(json_out_obj(NULL, NULL, NULL)),
|
||||
"{id:%}", JSON_SCAN(json_to_node_id, &local_id));
|
||||
|
||||
global_gossmap = notleak_with_children(gossmap_load(NULL,
|
||||
GOSSIP_STORE_FILENAME,
|
||||
&num_cupdates_rejected));
|
||||
global_gossmap = gossmap_load(NULL,
|
||||
GOSSIP_STORE_FILENAME,
|
||||
&num_cupdates_rejected);
|
||||
if (!global_gossmap)
|
||||
plugin_err(plugin, "Could not load gossmap %s: %s",
|
||||
GOSSIP_STORE_FILENAME, strerror(errno));
|
||||
@@ -705,6 +713,9 @@ static const char *init(struct plugin *p,
|
||||
plugin_log(plugin, LOG_DBG,
|
||||
"gossmap ignored %zu channel updates",
|
||||
num_cupdates_rejected);
|
||||
#if DEVELOPER
|
||||
plugin_set_memleak_handler(p, memleak_mark);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user