mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossipd: don't delay the very first channel_update.
Lightning charge tests stopped working without a timeout, being unable to find a route. The 15 second delay doesn't matter in real life, but in these scenarios it does. This fixes it by making sure the channel is usable immediately. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
bc7ca34a38
commit
74521b3fb7
@@ -1163,7 +1163,8 @@ static void destroy_local_update(struct local_update *local_update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void queue_local_update(struct daemon *daemon,
|
static void queue_local_update(struct daemon *daemon,
|
||||||
struct local_update *local_update)
|
struct local_update *local_update,
|
||||||
|
bool instant)
|
||||||
{
|
{
|
||||||
/* Free any old unapplied update. */
|
/* Free any old unapplied update. */
|
||||||
tal_free(find_local_update(daemon, &local_update->scid));
|
tal_free(find_local_update(daemon, &local_update->scid));
|
||||||
@@ -1171,6 +1172,9 @@ static void queue_local_update(struct daemon *daemon,
|
|||||||
list_add_tail(&daemon->local_updates, &local_update->list);
|
list_add_tail(&daemon->local_updates, &local_update->list);
|
||||||
tal_add_destructor(local_update, destroy_local_update);
|
tal_add_destructor(local_update, destroy_local_update);
|
||||||
|
|
||||||
|
if (instant)
|
||||||
|
apply_delayed_local_update(local_update);
|
||||||
|
else
|
||||||
/* Delay 1/4 a broadcast interval */
|
/* Delay 1/4 a broadcast interval */
|
||||||
new_reltimer(&daemon->timers, local_update,
|
new_reltimer(&daemon->timers, local_update,
|
||||||
time_from_msec(daemon->broadcast_interval/4),
|
time_from_msec(daemon->broadcast_interval/4),
|
||||||
@@ -1181,6 +1185,7 @@ static void handle_local_channel_update(struct peer *peer, const u8 *msg)
|
|||||||
{
|
{
|
||||||
struct chan *chan;
|
struct chan *chan;
|
||||||
struct local_update *local_update;
|
struct local_update *local_update;
|
||||||
|
bool delay;
|
||||||
const struct pubkey *my_id = &peer->daemon->rstate->local_id;
|
const struct pubkey *my_id = &peer->daemon->rstate->local_id;
|
||||||
|
|
||||||
local_update = tal(peer->daemon, struct local_update);
|
local_update = tal(peer->daemon, struct local_update);
|
||||||
@@ -1224,9 +1229,12 @@ static void handle_local_channel_update(struct peer *peer, const u8 *msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't delay the initialization update. */
|
||||||
|
delay = !is_halfchan_defined(&chan->half[local_update->direction]);
|
||||||
|
|
||||||
/* channeld has reconnected, remove local disable. */
|
/* channeld has reconnected, remove local disable. */
|
||||||
chan->local_disabled = false;
|
chan->local_disabled = false;
|
||||||
queue_local_update(peer->daemon, local_update);
|
queue_local_update(peer->daemon, local_update, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1862,7 +1870,7 @@ static void gossip_disable_outgoing_halfchan(struct daemon *daemon,
|
|||||||
|
|
||||||
local_update->disable = true;
|
local_update->disable = true;
|
||||||
|
|
||||||
queue_local_update(daemon, local_update);
|
queue_local_update(daemon, local_update, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user