diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 524602221..94b7a196b 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -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 diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 01157b5f0..c0afc9cc2 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -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):