Browse Source

gossipd: remove too-loose timestamp workaround.

Now timestamps always increment, we don't have to allow them to do the
wrong thing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
88053bd1ca
  1. 26
      gossipd/routing.c

26
gossipd/routing.c

@ -876,10 +876,7 @@ static void update_pending(struct pending_cannouncement *pending,
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&pending->short_channel_id), direction); &pending->short_channel_id), direction);
/* FIXME: This should be <, but in our tests we sometimes can generate if (pending->update_timestamps[direction] < timestamp) {
* more than one update per second, and we don't coordinate timestamps
* between gossipd and channeld. */
if (pending->update_timestamps[direction] <= timestamp) {
if (pending->updates[direction]) { if (pending->updates[direction]) {
status_trace("Replacing existing update"); status_trace("Replacing existing update");
tal_free(pending->updates[direction]); tal_free(pending->updates[direction]);
@ -1041,14 +1038,19 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
c = &chan->half[direction]; c = &chan->half[direction];
/* FIXME: This should be >=, but in our tests we sometimes can generate if (is_halfchan_defined(c) && timestamp <= c->last_timestamp) {
* more than one update per second, and we don't coordinate timestamps /* They're not supposed to do this! */
* between gossipd and channeld. But don't update just because of if (timestamp == c->last_timestamp
* re-transmissions, either. */ && !memeq(c->channel_update, tal_len(c->channel_update),
if (is_halfchan_defined(c) serialized, tal_len(serialized))) {
&& (c->last_timestamp > timestamp status_unusual("Bad gossip repeated timestamp for %s(%u): %s then %s",
|| memeq(c->channel_update, tal_len(c->channel_update), type_to_string(tmpctx,
serialized, tal_len(serialized)))) { struct short_channel_id,
&short_channel_id),
flags,
tal_hex(tmpctx, c->channel_update),
tal_hex(tmpctx, serialized));
}
SUPERVERBOSE("Ignoring outdated update."); SUPERVERBOSE("Ignoring outdated update.");
return NULL; return NULL;
} }

Loading…
Cancel
Save