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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-10-15 10:29:44 +10:30 committed by neil saitug
parent 3702f0f17b
commit 1e59d2a738
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}