Skip to content

Commit

Permalink
gossipd: aggressively advertize *both* sides of channel_update.
Browse files Browse the repository at this point in the history
While one side was not produced by us, we have a vested interest in propagating it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: When we send our own gossip when a peer connects, also send any incoming channel_updates.
  • Loading branch information
rustyrussell committed Jul 20, 2023
1 parent 7409a93 commit 55d6a13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions gossipd/gossipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ static void dump_our_gossip(struct daemon *daemon, struct peer *peer)
return;

for (chan = first_chan(me, &i); chan; chan = next_chan(me, &i)) {
int dir = half_chan_idx(me, chan);

/* Don't leak private channels, unless it's with you! */
if (!is_chan_public(chan)) {
/* Don't leak private channels, unless it's with you! */
int dir = half_chan_idx(me, chan);

if (node_id_eq(&chan->nodes[!dir]->id, &peer->id)
&& is_halfchan_defined(&chan->half[dir])) {
/* There's no announce for this, of course! */
Expand All @@ -455,9 +455,12 @@ static void dump_our_gossip(struct daemon *daemon, struct peer *peer)
/* Send channel_announce */
queue_peer_from_store(peer, &chan->bcast);

/* Send channel_update if we have one */
if (is_halfchan_defined(&chan->half[dir]))
queue_peer_from_store(peer, &chan->half[dir].bcast);
/* Send both channel_updates (if they exist): both help people
* use our channel, so we care! */
for (int dir = 0; dir < 2; dir++) {
if (is_halfchan_defined(&chan->half[dir]))
queue_peer_from_store(peer, &chan->half[dir].bcast);
}
}

/* If we have one, we should send our own node_announcement */
Expand Down
1 change: 0 additions & 1 deletion tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,6 @@ def test_channel_resurrection(node_factory, bitcoind):
assert ("DELETED" in l)


@pytest.mark.xfail(strict=True)
def test_dump_own_gossip(node_factory):
"""We *should* send all self-related gossip unsolicited, if we have any"""
l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
Expand Down

0 comments on commit 55d6a13

Please sign in to comment.