From 1e59d2a738241db249d24fa5ea98bcdb5016c8e2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Oct 2019 10:29:44 +1030 Subject: [PATCH] gossipd: count channel_updates on new channels correctly. If we get a channel_update while we're still verifying the channel_announcement we didn't set the peer pointer, so it didn't get credit. As a result, the seeker tended to think we were done gossiping sooner than we were. Signed-off-by: Rusty Russell --- gossipd/routing.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 3e26a5d9f..6a871ccd0 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -1955,7 +1955,8 @@ bool handle_pending_cannouncement(struct daemon *daemon, static void update_pending(struct pending_cannouncement *pending, u32 timestamp, const u8 *update, - const u8 direction) + const u8 direction, + struct peer *peer) { SUPERVERBOSE("Deferring update for pending channel %s/%d", type_to_string(tmpctx, struct short_channel_id, @@ -1968,6 +1969,9 @@ static void update_pending(struct pending_cannouncement *pending, } pending->updates[direction] = tal_dup_arr(pending, u8, update, tal_count(update), 0); pending->update_timestamps[direction] = timestamp; + clear_softref(pending, &pending->update_peer_softref[direction]); + set_softref(pending, &pending->update_peer_softref[direction], + peer); } } @@ -2312,7 +2316,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES, struct short_channel_id, &short_channel_id), direction); - update_pending(pending, timestamp, serialized, direction); + update_pending(pending, timestamp, serialized, direction, peer); return NULL; }