Skip to content

Commit

Permalink
gossipd: be more verbose and less assert()ive on bad node_announcement.
Browse files Browse the repository at this point in the history
We hit the timestamp assert on ElementsProject#2750; it shouldn't happen, but crashing
doesn't leave much information.

Reported-by: @m-schmook
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 21, 2019
1 parent 9bf0467 commit fc27250
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions gossipd/gossipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,18 @@ static bool get_node_announcement(const tal_t *ctx,
n->bcast.index, tal_hex(tmpctx, msg));
return false;
}
assert(node_id_eq(&id, &n->id));
assert(timestamp == n->bcast.timestamp);

if (!node_id_eq(&id, &n->id) || timestamp != n->bcast.timestamp) {
status_broken("Wrong node_announcement @%u:"
" expected %s timestamp %u "
" got %s timestamp %u",
n->bcast.index,
type_to_string(tmpctx, struct node_id, &n->id),
timestamp,
type_to_string(tmpctx, struct node_id, &id),
n->bcast.timestamp);
return false;
}

*wireaddrs = read_addresses(ctx, addresses);
tal_free(addresses);
Expand Down

0 comments on commit fc27250

Please sign in to comment.