gossipd: hand gossmap to gossmap_manage_get_node_addresses, not gossmap_manage.

We don't want to to refresh the gossmap internally: this could invalidate the
gossmap held by the current callers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-11-22 14:03:38 +10:30
parent 69c252e06f
commit d5c0d21db8
6 changed files with 11 additions and 11 deletions

View file

@ -186,12 +186,13 @@ static struct io_plan *handle_get_address(struct io_conn *conn,
{
struct node_id id;
struct wireaddr *addrs;
struct gossmap *gossmap = gossmap_manage_get_gossmap(daemon->gm);
if (!fromwire_gossipd_get_addrs(msg, &id))
master_badmsg(WIRE_GOSSIPD_GET_ADDRS, msg);
addrs = gossmap_manage_get_node_addresses(tmpctx,
daemon->gm,
gossmap,
&id);
daemon_conn_send(daemon->master,

View file

@ -1435,7 +1435,7 @@ void gossmap_manage_tell_lightningd_locals(struct daemon *daemon,
}
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
struct gossmap_manage *gm,
struct gossmap *gossmap,
const struct node_id *node_id)
{
struct gossmap_node *node;
@ -1447,7 +1447,6 @@ struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
u8 rgb_color[3], alias[32];
struct tlv_node_ann_tlvs *na_tlvs;
struct wireaddr *wireaddrs;
struct gossmap *gossmap = gossmap_manage_get_gossmap(gm);
node = gossmap_find_node(gossmap, node_id);
if (!node)

View file

@ -105,13 +105,13 @@ void gossmap_manage_new_peer(struct gossmap_manage *gm,
/**
* gossmap_manage_get_node_addresses: get addresses for this node.
* @ctx: the allocation context
* @gm: the gossmap_manage context
* @gossmap: the gossmap
* @node_id: the node_id to look up
*
* Returns NULL if we don't have node_announcement for it.
*/
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
struct gossmap_manage *gm,
struct gossmap *gossmap,
const struct node_id *node_id);
/**

View file

@ -990,7 +990,7 @@ static struct node_and_addrs *get_random_node(const tal_t *ctx,
gossmap_node_get_id(gossmap, node, found_node->id);
found_node->addrs =
gossmap_manage_get_node_addresses(found_node,
seeker->daemon->gm,
gossmap,
found_node->id);
if (found_node->addrs && tal_count(found_node->addrs) != 0)
return found_node;

View file

@ -67,7 +67,7 @@ struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm UNNEEDED)
{ fprintf(stderr, "gossmap_manage_get_gossmap called!\n"); abort(); }
/* Generated stub for gossmap_manage_get_node_addresses */
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx UNNEEDED,
struct gossmap_manage *gm UNNEEDED,
struct gossmap *gossmap UNNEEDED,
const struct node_id *node_id UNNEEDED)
{ fprintf(stderr, "gossmap_manage_get_node_addresses called!\n"); abort(); }
/* Generated stub for gossmap_max_node_idx */
@ -92,9 +92,9 @@ struct gossmap_node *gossmap_nth_node(const struct gossmap *map UNNEEDED,
const struct gossmap_chan *chan UNNEEDED,
int n UNNEEDED)
{ fprintf(stderr, "gossmap_nth_node called!\n"); abort(); }
/* Generated stub for gossmap_num_nodes */
size_t gossmap_num_nodes(const struct gossmap *map UNNEEDED)
{ fprintf(stderr, "gossmap_num_nodes called!\n"); abort(); }
/* Generated stub for gossmap_random_node */
struct gossmap_node *gossmap_random_node(const struct gossmap *map UNNEEDED)
{ fprintf(stderr, "gossmap_random_node called!\n"); abort(); }
/* Generated stub for memleak_scan_intmap_ */
void memleak_scan_intmap_(struct htable *memtable UNNEEDED, const struct intmap *m UNNEEDED)
{ fprintf(stderr, "memleak_scan_intmap_ called!\n"); abort(); }

View file

@ -213,7 +213,7 @@ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED,
{ fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); }
/* Generated stub for new_inflight */
struct channel_inflight *new_inflight(struct channel *channel UNNEEDED,
struct pubkey *remote_funding UNNEEDED,
struct pubkey *remote_funding STEALS UNNEEDED,
const struct bitcoin_outpoint *funding_outpoint UNNEEDED,
u32 funding_feerate UNNEEDED,
struct amount_sat funding_sat UNNEEDED,