Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gossipd: extra debugging when inject fails. #7738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gossipd/gossipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ static void inject_gossip(struct daemon *daemon, const u8 *msg)
case WIRE_CHANNEL_UPDATE:
err = gossmap_manage_channel_update(tmpctx,
daemon->gm,
take(goss), NULL);
goss, NULL);
if (err)
status_debug("update %s gave error %s",
tal_hex(tmpctx, goss), err);
break;
default:
err = tal_fmt(tmpctx, "unknown gossip type %i",
Expand Down
15 changes: 13 additions & 2 deletions gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,11 @@ static const char *process_channel_update(const tal_t *ctx,
chan = gossmap_find_chan(gossmap, &scid);
if (!chan) {
/* Did we explicitly reject announce? Ignore completely. */
if (in_txout_failures(gm->txf, scid))
if (in_txout_failures(gm->txf, scid)) {
status_debug("Previously-rejected announce for %s",
fmt_short_channel_id(tmpctx, scid));
return NULL;
}

/* Seeker may want to ask about this. */
query_unknown_channel(gm->daemon, source_peer, scid);
Expand Down Expand Up @@ -767,6 +770,8 @@ static const char *process_channel_update(const tal_t *ctx,
u32 prev_timestamp
= gossip_store_get_timestamp(gm->daemon->gs, chan->cupdate_off[dir]);
if (prev_timestamp >= timestamp) {
status_debug("Too-old update for %s",
fmt_short_channel_id(tmpctx, scid));
/* Too old, ignore */
return NULL;
}
Expand Down Expand Up @@ -850,11 +855,15 @@ const char *gossmap_manage_channel_update(const tal_t *ctx,
}

/* Don't accept ancient or far-future timestamps. */
if (!timestamp_reasonable(gm->daemon, timestamp))
if (!timestamp_reasonable(gm->daemon, timestamp)) {
status_debug("Unreasonable timestamp in %s", tal_hex(tmpctx, update));
return NULL;
}

/* Still waiting? */
if (map_get(&gm->pending_ann_map, scid)) {
status_debug("Enqueueing update for announcne %s",
tal_hex(tmpctx, update));
enqueue_cupdate(&gm->pending_cupdates,
scid,
&signature,
Expand All @@ -873,6 +882,8 @@ const char *gossmap_manage_channel_update(const tal_t *ctx,

/* Too early? */
if (map_get(&gm->early_ann_map, scid)) {
status_debug("Enqueueing update for too early %s",
tal_hex(tmpctx, update));
enqueue_cupdate(&gm->early_cupdates,
scid,
&signature,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,8 +1845,8 @@ def test_addgossip(node_factory):
opts={'log-level': 'io'})

# We should get two node_announcements, one channel_announcement, and two
# channel_update.
l3 = node_factory.get_node()
# channel_update. We deliberately inject bad gossip!
l3 = node_factory.get_node(allow_bad_gossip=True)

# 0x0100 = channel_announcement
# 0x0102 = channel_update
Expand Down
Loading