mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-10 09:12:16 +01:00
common: gossmap now always ignores private gossip_store messages.
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>
This commit is contained in:
parent
58a1c4c012
commit
4b92c773df
7 changed files with 6 additions and 29 deletions
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue