mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
gossipd: make sure we also spam private channels with the peer involved.
Probably not required, but nice to have. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
8ef4b36a1f
commit
46bb6beee7
@ -129,6 +129,15 @@ void queue_peer_from_store(struct peer *peer,
|
||||
queue_peer_msg(peer, take(gossip_store_get(NULL, gs, bcast->index)));
|
||||
}
|
||||
|
||||
static void queue_priv_update(struct peer *peer,
|
||||
const struct broadcastable *bcast)
|
||||
{
|
||||
struct gossip_store *gs = peer->daemon->rstate->gs;
|
||||
queue_peer_msg(peer,
|
||||
take(gossip_store_get_private_update(NULL, gs,
|
||||
bcast->index)));
|
||||
}
|
||||
|
||||
/*~ We don't actually keep node_announcements in memory; we keep them in
|
||||
* a file called `gossip_store`. If we need some node details, we reload
|
||||
* and reparse. It's slow, but generally rare. */
|
||||
@ -422,15 +431,26 @@ 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;
|
||||
int dir = half_chan_idx(me, chan);
|
||||
|
||||
if (!is_chan_public(chan))
|
||||
continue;
|
||||
if (!is_chan_public(chan)) {
|
||||
/* Don't leak private channels, unless it's with you! */
|
||||
if (!node_id_eq(&chan->nodes[!dir]->id, &peer->id))
|
||||
continue;
|
||||
/* There's no announce for this, of course! */
|
||||
/* Private channel updates are wrapped in the store. */
|
||||
else {
|
||||
if (!is_halfchan_defined(&chan->half[dir]))
|
||||
continue;
|
||||
queue_priv_update(peer, &chan->half[dir].bcast);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/* Send announce */
|
||||
queue_peer_from_store(peer, &chan->bcast);
|
||||
}
|
||||
|
||||
/* Send announce */
|
||||
queue_peer_from_store(peer, &chan->bcast);
|
||||
/* Send update if we have one */
|
||||
dir = half_chan_idx(me, chan);
|
||||
if (is_halfchan_defined(&chan->half[dir]))
|
||||
queue_peer_from_store(peer, &chan->half[dir].bcast);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user