mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
lightningd: tell gossipd that peers we load from db are important.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -255,8 +255,8 @@ static void funding_broadcast_failed(struct channel *channel,
|
|||||||
exitstatus, err);
|
exitstatus, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tell_gossipd_peer_is_important(struct lightningd *ld,
|
void tell_gossipd_peer_is_important(struct lightningd *ld,
|
||||||
const struct channel *channel)
|
const struct channel *channel)
|
||||||
{
|
{
|
||||||
u8 *msg;
|
u8 *msg;
|
||||||
|
|
||||||
|
|||||||
@@ -41,4 +41,7 @@ bool handle_opening_channel(struct lightningd *ld,
|
|||||||
|
|
||||||
void kill_uncommitted_channel(struct uncommitted_channel *uc,
|
void kill_uncommitted_channel(struct uncommitted_channel *uc,
|
||||||
const char *why);
|
const char *why);
|
||||||
|
|
||||||
|
void tell_gossipd_peer_is_important(struct lightningd *ld,
|
||||||
|
const struct channel *channel);
|
||||||
#endif /* LIGHTNING_LIGHTNINGD_OPENING_CONTROL_H */
|
#endif /* LIGHTNING_LIGHTNINGD_OPENING_CONTROL_H */
|
||||||
|
|||||||
@@ -1090,22 +1090,6 @@ static const struct json_command close_command = {
|
|||||||
};
|
};
|
||||||
AUTODATA(json_command, &close_command);
|
AUTODATA(json_command, &close_command);
|
||||||
|
|
||||||
static void try_reconnect(struct peer *peer)
|
|
||||||
{
|
|
||||||
struct lightningd *ld = peer->ld;
|
|
||||||
u8 *msg;
|
|
||||||
|
|
||||||
#if DEVELOPER
|
|
||||||
/* Don't schedule an attempt if we disabled reconnections with
|
|
||||||
* the `--dev-no-reconnect` flag */
|
|
||||||
if (ld->no_reconnect)
|
|
||||||
return;
|
|
||||||
#endif /* DEVELOPER */
|
|
||||||
|
|
||||||
msg = towire_gossipctl_reach_peer(NULL, &peer->id);
|
|
||||||
subd_send_msg(ld->gossip, take(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void activate_peer(struct peer *peer)
|
static void activate_peer(struct peer *peer)
|
||||||
{
|
{
|
||||||
u8 *msg;
|
u8 *msg;
|
||||||
@@ -1116,10 +1100,11 @@ static void activate_peer(struct peer *peer)
|
|||||||
msg = towire_gossipctl_peer_addrhint(peer, &peer->id, &peer->addr);
|
msg = towire_gossipctl_peer_addrhint(peer, &peer->id, &peer->addr);
|
||||||
subd_send_msg(peer->ld->gossip, take(msg));
|
subd_send_msg(peer->ld->gossip, take(msg));
|
||||||
|
|
||||||
/* We can only have one active channel: reconnect if not already. */
|
/* We can only have one active channel: make sure gossipd
|
||||||
|
* knows to reconnect. */
|
||||||
channel = peer_active_channel(peer);
|
channel = peer_active_channel(peer);
|
||||||
if (channel && !channel->owner)
|
if (channel)
|
||||||
try_reconnect(peer);
|
tell_gossipd_peer_is_important(ld, channel);
|
||||||
|
|
||||||
list_for_each(&peer->channels, channel, list) {
|
list_for_each(&peer->channels, channel, list) {
|
||||||
/* Watching lockin may be unnecessary, but it's harmless. */
|
/* Watching lockin may be unnecessary, but it's harmless. */
|
||||||
|
|||||||
@@ -364,6 +364,10 @@ void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED)
|
|||||||
/* Generated stub for subd_send_msg */
|
/* Generated stub for subd_send_msg */
|
||||||
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
|
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
|
||||||
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }
|
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }
|
||||||
|
/* Generated stub for tell_gossipd_peer_is_important */
|
||||||
|
void tell_gossipd_peer_is_important(struct lightningd *ld UNNEEDED,
|
||||||
|
const struct channel *channel UNNEEDED)
|
||||||
|
{ fprintf(stderr, "tell_gossipd_peer_is_important called!\n"); abort(); }
|
||||||
/* Generated stub for towire_channel_dev_reenable_commit */
|
/* Generated stub for towire_channel_dev_reenable_commit */
|
||||||
u8 *towire_channel_dev_reenable_commit(const tal_t *ctx UNNEEDED)
|
u8 *towire_channel_dev_reenable_commit(const tal_t *ctx UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_channel_dev_reenable_commit called!\n"); abort(); }
|
{ fprintf(stderr, "towire_channel_dev_reenable_commit called!\n"); abort(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user