gossipd: when we dump our own gossip, include our node_announcement.

@endothermicdev and I found this while investigating a "nobody sees my node_announcement" bug report.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: #6410
Reported-by: benjaminchodroff on discord
Changelog-Fixed: Protocol: When we send our own gossip when a peer connects, send our node_announcement too (regression in v23.05)
This commit is contained in:
Rusty Russell 2023-07-20 12:10:52 +09:30
parent ef4db6648d
commit 7409a93d17
2 changed files with 9 additions and 3 deletions

View file

@ -459,6 +459,10 @@ static void dump_our_gossip(struct daemon *daemon, struct peer *peer)
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 */
if (me->bcast.index)
queue_peer_from_store(peer, &me->bcast);
}
/*~ This is where connectd tells us about a new peer we might want to

View file

@ -1383,9 +1383,10 @@ def test_gossipwith(node_factory):
check=True,
timeout=TIMEOUT, stdout=subprocess.PIPE).stdout
num_msgs = 0
msgs = set()
while len(out):
l, t = struct.unpack('>HH', out[0:4])
msg = out[2:2 + l]
out = out[2 + l:]
# Ignore pings, timestamp_filter
@ -1393,10 +1394,11 @@ def test_gossipwith(node_factory):
continue
# channel_announcement node_announcement or channel_update
assert t == 256 or t == 257 or t == 258
num_msgs += 1
msgs.add(msg)
# one channel announcement, two channel_updates, two node announcements.
assert num_msgs == 7
# due to initial blast, we can have duplicates!
assert len(msgs) == 5
def test_gossip_notices_close(node_factory, bitcoind):