lightningd: turn on node_announcement generation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-31 13:46:19 +10:30
parent b76d589a6e
commit 418ac4ed90
5 changed files with 14 additions and 11 deletions

View file

@ -494,6 +494,8 @@ static void send_channel_announcement(struct channel *channel)
-1, 0, send_channel_announce_addgossip_reply, channel);
/* We can also send our first public channel_update now */
broadcast_public_cupdate(channel, true);
/* And maybe our first node_announcement */
channel_gossip_node_announce(ld);
}
static void set_gossip_state(struct channel *channel,
@ -790,6 +792,8 @@ static void set_not_starting_up(struct lightningd *ld)
{
starting_up = false;
log_debug(ld->log, "channel_gossip: no longer in startup mode");
/* Now we can create/update a node_announcement */
channel_gossip_node_announce(ld);
}
/* We also wait ten seconds *after* connection, for lease registration */
@ -1055,6 +1059,10 @@ void channel_gossip_node_announce(struct lightningd *ld)
add_node_announcement_sig(nannounce, &sig);
/* Update our cached copy. */
tal_free(ld->node_announcement);
ld->node_announcement = tal_steal(ld, nannounce);
/* Tell gossipd. */
subd_req(ld->gossip, ld->gossip,
take(towire_gossipd_addgossip(NULL, nannounce)),

View file

@ -357,9 +357,8 @@ static struct command_result *json_setleaserates(struct command *cmd,
if (!lease_rates_empty(rates))
cmd->ld->lease_rates = tal_steal(cmd->ld, rates);
/* Call gossipd, let them know we've got new rates */
subd_send_msg(cmd->ld->gossip,
take(towire_gossipd_new_lease_rates(NULL, rates)));
/* This may generate a new node_announcement */
channel_gossip_node_announce(cmd->ld);
res = json_stream_success(cmd);
json_add_amount_sat_msat(res, "lease_fee_base_msat",

View file

@ -1711,8 +1711,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg)
log_debug(ld->log,
"Update our node_announcement for discovered address: %s",
fmt_wireaddr(tmpctx, best));
subd_send_msg(ld->gossip,
towire_gossipd_discovered_ip(tmpctx, best));
channel_gossip_node_announce(ld);
}
}

View file

@ -87,6 +87,9 @@ void channel_fail_transient(struct channel *channel UNNEEDED,
/* Generated stub for channel_gossip_get_remote_update */
const struct peer_update *channel_gossip_get_remote_update(const struct channel *channel UNNEEDED)
{ fprintf(stderr, "channel_gossip_get_remote_update called!\n"); abort(); }
/* Generated stub for channel_gossip_node_announce */
void channel_gossip_node_announce(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "channel_gossip_node_announce called!\n"); abort(); }
/* Generated stub for channel_gossip_peer_connected */
void channel_gossip_peer_connected(struct peer *peer UNNEEDED)
{ fprintf(stderr, "channel_gossip_peer_connected called!\n"); abort(); }
@ -951,9 +954,6 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
const struct channel_id *channel UNNEEDED,
const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "towire_errorfmt called!\n"); abort(); }
/* Generated stub for towire_gossipd_discovered_ip */
u8 *towire_gossipd_discovered_ip(const tal_t *ctx UNNEEDED, const struct wireaddr *discovered_ip UNNEEDED)
{ fprintf(stderr, "towire_gossipd_discovered_ip called!\n"); abort(); }
/* Generated stub for towire_hsmd_preapprove_invoice */
u8 *towire_hsmd_preapprove_invoice(const tal_t *ctx UNNEEDED, const wirestring *invstring UNNEEDED)
{ fprintf(stderr, "towire_hsmd_preapprove_invoice called!\n"); abort(); }

View file

@ -1065,9 +1065,6 @@ u8 *towire_final_incorrect_htlc_amount(const tal_t *ctx UNNEEDED, struct amount_
/* Generated stub for towire_gossipd_addgossip */
u8 *towire_gossipd_addgossip(const tal_t *ctx UNNEEDED, const u8 *msg UNNEEDED)
{ fprintf(stderr, "towire_gossipd_addgossip called!\n"); abort(); }
/* Generated stub for towire_gossipd_discovered_ip */
u8 *towire_gossipd_discovered_ip(const tal_t *ctx UNNEEDED, const struct wireaddr *discovered_ip UNNEEDED)
{ fprintf(stderr, "towire_gossipd_discovered_ip called!\n"); abort(); }
/* Generated stub for towire_hsmd_check_pubkey */
u8 *towire_hsmd_check_pubkey(const tal_t *ctx UNNEEDED, u32 index UNNEEDED, const struct pubkey *pubkey UNNEEDED)
{ fprintf(stderr, "towire_hsmd_check_pubkey called!\n"); abort(); }