Skip to content

Commit

Permalink
common: gossmap now always ignores private gossip_store messages.
Browse files Browse the repository at this point in the history
In the next PR, they'll be removed, but for now all our code doesn't
want them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Nov 28, 2023
1 parent 96996f2 commit 451367c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 29 deletions.
6 changes: 0 additions & 6 deletions common/gossmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <unistd.h>
#include <wire/peer_wire.h>

bool gossmap_public_only;

/* We need this global to decode indexes for hash functions */
static struct gossmap *map;

Expand Down Expand Up @@ -638,12 +636,8 @@ static bool map_catchup(struct gossmap *map, size_t *num_rejected)
type = map_be16(map, off);
if (type == WIRE_CHANNEL_ANNOUNCEMENT)
add_channel(map, off, false);
else if (type == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL && !gossmap_public_only)
add_channel(map, off + 2 + 8 + 2, true);
else if (type == WIRE_CHANNEL_UPDATE)
num_bad += !update_channel(map, off);
else if (type == WIRE_GOSSIP_STORE_PRIVATE_UPDATE && !gossmap_public_only)
num_bad += !update_channel(map, off + 2 + 2);
else if (type == WIRE_GOSSIP_STORE_DELETE_CHAN)
remove_channel_by_deletemsg(map, off);
else if (type == WIRE_NODE_ANNOUNCEMENT)
Expand Down
3 changes: 0 additions & 3 deletions common/gossmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ struct gossmap_chan {
} half[2];
};

/* Temporary flag for testing: don't load private gossip info! */
extern bool gossmap_public_only;

/* If num_channel_updates_rejected is not NULL, indicates how many channels we
* marked inactive because their values were too high to be represented. */
struct gossmap *gossmap_load(const tal_t *ctx, const char *filename,
Expand Down
2 changes: 0 additions & 2 deletions plugins/fetchinvoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,6 @@ static const struct plugin_hook hooks[] = {
int main(int argc, char *argv[])
{
setup_locale();
/* We are migrated, ready for public-only gossmap! */
gossmap_public_only = true;
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL,
commands, ARRAY_SIZE(commands),
/* No notifications */
Expand Down
2 changes: 0 additions & 2 deletions plugins/keysend.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,6 @@ int main(int argc, char *argv[])
features->bits[i] = tal_arr(features, u8, 0);
set_feature_bit(&features->bits[NODE_ANNOUNCE_FEATURE], KEYSEND_FEATUREBIT);

/* We are migrated, ready for public-only gossmap! */
gossmap_public_only = true;
plugin_main(argv, init, PLUGIN_STATIC, true, features, commands,
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
notification_topics, ARRAY_SIZE(notification_topics), NULL);
Expand Down
2 changes: 0 additions & 2 deletions plugins/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,6 @@ static const char *notification_topics[] = {
int main(int argc, char *argv[])
{
setup_locale();
/* We are migrated, ready for public-only gossmap! */
gossmap_public_only = true;
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
ARRAY_SIZE(commands), NULL, 0, NULL, 0,
notification_topics, ARRAY_SIZE(notification_topics),
Expand Down
3 changes: 0 additions & 3 deletions plugins/renepay/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,6 @@ int main(int argc, char *argv[])
pay_plugin = tal(NULL, struct pay_plugin);
pay_plugin->debug_mcf = pay_plugin->debug_payflow = false;

/* We are migrated, ready for public-only gossmap! */
gossmap_public_only = true;

plugin_main(
argv,
init,
Expand Down
17 changes: 6 additions & 11 deletions plugins/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ static struct node_id local_id;
static struct plugin *plugin;

/* We load this on demand, since we can start before gossipd. */
static struct gossmap *get_gossmap(bool public_only)
static struct gossmap *get_gossmap(void)
{
/* Temporary hack so callers can individually exclude private gossip */
tal_free(global_gossmap);
gossmap_public_only = public_only;
global_gossmap = gossmap_load(NULL,
GOSSIP_STORE_FILENAME,
NULL);
gossmap_refresh(global_gossmap, NULL);
return global_gossmap;
}

Expand Down Expand Up @@ -170,7 +165,7 @@ listpeerchannels_getroute_done(struct command *cmd,
gossmod_add_localchan, NULL);

/* Overlay local knowledge for dijkstra */
gossmap = get_gossmap(true);
gossmap = get_gossmap();
gossmap_apply_localmods(gossmap, mods);
res = try_route(cmd, gossmap, info);
gossmap_remove_localmods(gossmap, mods);
Expand Down Expand Up @@ -359,7 +354,7 @@ static struct command_result *listpeerchannels_done(struct command *cmd,
struct node_map *connected;
struct gossmap_chan *c;
struct json_stream *js;
struct gossmap *gossmap = get_gossmap(true);
struct gossmap *gossmap = get_gossmap();

connected = local_connected(opts, buf, result);

Expand Down Expand Up @@ -515,7 +510,7 @@ static struct command_result *json_listnodes(struct command *cmd,
NULL))
return command_param_failed();

gossmap = get_gossmap(true);
gossmap = get_gossmap();
js = jsonrpc_stream_success(cmd);
json_array_start(js, "nodes");
if (id) {
Expand Down Expand Up @@ -576,7 +571,7 @@ listpeerchannels_listincoming_done(struct command *cmd,
NULL);

/* Overlay local knowledge */
gossmap = get_gossmap(true);
gossmap = get_gossmap();
gossmap_apply_localmods(gossmap, mods);

js = jsonrpc_stream_success(cmd);
Expand Down

0 comments on commit 451367c

Please sign in to comment.