Skip to content

Commit d5c0d21

Browse files
committed
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 <[email protected]>
1 parent 69c252e commit d5c0d21

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

gossipd/gossipd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,13 @@ static struct io_plan *handle_get_address(struct io_conn *conn,
186186
{
187187
struct node_id id;
188188
struct wireaddr *addrs;
189+
struct gossmap *gossmap = gossmap_manage_get_gossmap(daemon->gm);
189190

190191
if (!fromwire_gossipd_get_addrs(msg, &id))
191192
master_badmsg(WIRE_GOSSIPD_GET_ADDRS, msg);
192193

193194
addrs = gossmap_manage_get_node_addresses(tmpctx,
194-
daemon->gm,
195+
gossmap,
195196
&id);
196197

197198
daemon_conn_send(daemon->master,

gossipd/gossmap_manage.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ void gossmap_manage_tell_lightningd_locals(struct daemon *daemon,
14351435
}
14361436

14371437
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
1438-
struct gossmap_manage *gm,
1438+
struct gossmap *gossmap,
14391439
const struct node_id *node_id)
14401440
{
14411441
struct gossmap_node *node;
@@ -1447,7 +1447,6 @@ struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
14471447
u8 rgb_color[3], alias[32];
14481448
struct tlv_node_ann_tlvs *na_tlvs;
14491449
struct wireaddr *wireaddrs;
1450-
struct gossmap *gossmap = gossmap_manage_get_gossmap(gm);
14511450

14521451
node = gossmap_find_node(gossmap, node_id);
14531452
if (!node)

gossipd/gossmap_manage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ void gossmap_manage_new_peer(struct gossmap_manage *gm,
105105
/**
106106
* gossmap_manage_get_node_addresses: get addresses for this node.
107107
* @ctx: the allocation context
108-
* @gm: the gossmap_manage context
108+
* @gossmap: the gossmap
109109
* @node_id: the node_id to look up
110110
*
111111
* Returns NULL if we don't have node_announcement for it.
112112
*/
113113
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx,
114-
struct gossmap_manage *gm,
114+
struct gossmap *gossmap,
115115
const struct node_id *node_id);
116116

117117
/**

gossipd/seeker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static struct node_and_addrs *get_random_node(const tal_t *ctx,
990990
gossmap_node_get_id(gossmap, node, found_node->id);
991991
found_node->addrs =
992992
gossmap_manage_get_node_addresses(found_node,
993-
seeker->daemon->gm,
993+
gossmap,
994994
found_node->id);
995995
if (found_node->addrs && tal_count(found_node->addrs) != 0)
996996
return found_node;

gossipd/test/run-next_block_range.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm UNNEEDED)
6767
{ fprintf(stderr, "gossmap_manage_get_gossmap called!\n"); abort(); }
6868
/* Generated stub for gossmap_manage_get_node_addresses */
6969
struct wireaddr *gossmap_manage_get_node_addresses(const tal_t *ctx UNNEEDED,
70-
struct gossmap_manage *gm UNNEEDED,
70+
struct gossmap *gossmap UNNEEDED,
7171
const struct node_id *node_id UNNEEDED)
7272
{ fprintf(stderr, "gossmap_manage_get_node_addresses called!\n"); abort(); }
7373
/* Generated stub for gossmap_max_node_idx */
@@ -92,9 +92,9 @@ struct gossmap_node *gossmap_nth_node(const struct gossmap *map UNNEEDED,
9292
const struct gossmap_chan *chan UNNEEDED,
9393
int n UNNEEDED)
9494
{ fprintf(stderr, "gossmap_nth_node called!\n"); abort(); }
95-
/* Generated stub for gossmap_num_nodes */
96-
size_t gossmap_num_nodes(const struct gossmap *map UNNEEDED)
97-
{ fprintf(stderr, "gossmap_num_nodes called!\n"); abort(); }
95+
/* Generated stub for gossmap_random_node */
96+
struct gossmap_node *gossmap_random_node(const struct gossmap *map UNNEEDED)
97+
{ fprintf(stderr, "gossmap_random_node called!\n"); abort(); }
9898
/* Generated stub for memleak_scan_intmap_ */
9999
void memleak_scan_intmap_(struct htable *memtable UNNEEDED, const struct intmap *m UNNEEDED)
100100
{ fprintf(stderr, "memleak_scan_intmap_ called!\n"); abort(); }

wallet/test/run-db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED,
213213
{ fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); }
214214
/* Generated stub for new_inflight */
215215
struct channel_inflight *new_inflight(struct channel *channel UNNEEDED,
216-
struct pubkey *remote_funding UNNEEDED,
216+
struct pubkey *remote_funding STEALS UNNEEDED,
217217
const struct bitcoin_outpoint *funding_outpoint UNNEEDED,
218218
u32 funding_feerate UNNEEDED,
219219
struct amount_sat funding_sat UNNEEDED,

0 commit comments

Comments
 (0)