Skip to content

Commit

Permalink
lightningd: turn on node_announcement generation.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jan 31, 2024
1 parent b76d589 commit 418ac4e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
8 changes: 8 additions & 0 deletions lightningd/channel_gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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)),
Expand Down
5 changes: 2 additions & 3 deletions lightningd/gossip_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lightningd/test/run-invoice-select-inchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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(); }
Expand Down
3 changes: 0 additions & 3 deletions wallet/test/run-wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down

0 comments on commit 418ac4e

Please sign in to comment.