gossipd: aggressively advertize *both* sides of channel_update.

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.
This commit is contained in:
Rusty Russell
2023-07-20 12:11:14 +09:30
parent 7409a93d17
commit 55d6a13ffc
2 changed files with 9 additions and 7 deletions

View File

@@ -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! */
@@ -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 */

View File

@@ -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)