Skip to content

Commit

Permalink
gossipd: Make gossipd much quieter
Browse files Browse the repository at this point in the history
We are logging way too much from gossipd, causing noisy logs. This PR reduces
logs for incoming messages to those that actually caused a change in our
internal state (duplicate and old messages are just dropped silently now).

Changelog-Changed: gossipd: The `gossipd` is now a lot quieter, and will log only when a message changed our network topology.
  • Loading branch information
cdecker authored and rustyrussell committed Aug 27, 2020
1 parent bdad5a6 commit f598517
Showing 1 changed file with 32 additions and 36 deletions.
68 changes: 32 additions & 36 deletions gossipd/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -2090,13 +2090,11 @@ bool routing_add_channel_update(struct routing_state *rstate,

/* Check timestamp is sane (unless from store). */
if (!index && !timestamp_reasonable(rstate, timestamp)) {
status_peer_debug(peer ? &peer->id : NULL,
"Ignoring update timestamp %u for %s/%u",
timestamp,
type_to_string(tmpctx,
struct short_channel_id,
&short_channel_id),
direction);
SUPERVERBOSE("Ignoring update timestamp %u for %s/%u",
timestamp,
type_to_string(tmpctx, struct short_channel_id,
&short_channel_id),
direction);
return false;
}

Expand Down Expand Up @@ -2127,14 +2125,12 @@ bool routing_add_channel_update(struct routing_state *rstate,
/* Allow redundant updates once every 7 days */
if (timestamp < hc->bcast.timestamp + GOSSIP_PRUNE_INTERVAL(rstate->dev_fast_gossip_prune) / 2
&& !cupdate_different(rstate->gs, hc, update)) {
status_peer_debug(peer ? &peer->id : NULL,
"Ignoring redundant update for %s/%u"
" (last %u, now %u)",
type_to_string(tmpctx,
struct short_channel_id,
&short_channel_id),
direction,
hc->bcast.timestamp, timestamp);
SUPERVERBOSE("Ignoring redundant update for %s/%u"
" (last %u, now %u)",
type_to_string(tmpctx,
struct short_channel_id,
&short_channel_id),
direction, hc->bcast.timestamp, timestamp);
/* Ignoring != failing */
return true;
}
Expand Down Expand Up @@ -2221,6 +2217,14 @@ bool routing_add_channel_update(struct routing_state *rstate,
process_pending_node_announcement(rstate, &chan->nodes[1]->id);
tal_free(uc);
}

status_peer_debug(peer ? &peer->id : NULL,
"Received channel_update for channel %s/%d now %s",
type_to_string(tmpctx, struct short_channel_id,
&short_channel_id),
channel_flags & 0x01,
channel_flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE");

return true;
}

Expand Down Expand Up @@ -2368,13 +2372,6 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES,
return err;
}

status_peer_debug(peer ? &peer->id : NULL,
"Received channel_update for channel %s/%d now %s",
type_to_string(tmpctx, struct short_channel_id,
&short_channel_id),
channel_flags & 0x01,
channel_flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE");

routing_add_channel_update(rstate, take(serialized), 0, peer);
return NULL;
}
Expand Down Expand Up @@ -2439,13 +2436,6 @@ bool routing_add_node_announcement(struct routing_state *rstate,
return false;
}

/* Only log this if *not* loading from store. */
if (!index)
status_peer_debug(peer ? &peer->id : NULL,
"Received node_announcement for node %s",
type_to_string(tmpctx, struct node_id,
&node_id));

node = get_node(rstate, &node_id);

if (node == NULL || !node_has_broadcastable_channels(node)) {
Expand Down Expand Up @@ -2500,13 +2490,11 @@ bool routing_add_node_announcement(struct routing_state *rstate,
/* Allow redundant updates once every 7 days */
if (timestamp < node->bcast.timestamp + GOSSIP_PRUNE_INTERVAL(rstate->dev_fast_gossip_prune) / 2
&& !nannounce_different(rstate->gs, node, msg)) {
status_peer_debug(peer ? &peer->id : NULL,
"Ignoring redundant nannounce for %s"
" (last %u, now %u)",
type_to_string(tmpctx,
struct node_id,
&node_id),
node->bcast.timestamp, timestamp);
SUPERVERBOSE(
"Ignoring redundant nannounce for %s"
" (last %u, now %u)",
type_to_string(tmpctx, struct node_id, &node_id),
node->bcast.timestamp, timestamp);
/* Ignoring != failing */
return true;
}
Expand Down Expand Up @@ -2553,6 +2541,14 @@ bool routing_add_node_announcement(struct routing_state *rstate,
NULL);
peer_supplied_good_gossip(peer, 1);
}

/* Only log this if *not* loading from store. */
if (!index)
status_peer_debug(peer ? &peer->id : NULL,
"Received node_announcement for node %s",
type_to_string(tmpctx, struct node_id,
&node_id));

return true;
}

Expand Down

0 comments on commit f598517

Please sign in to comment.