P2 subscribes to the topic "topic" and and the peers from the fanout will be added to the mesh which will result in a GRAFT to peer P1.
The spec states:
It is an error to GRAFT on an explicit peer, [...]
Therefore I assume this is a bug and either direct peers shouldn't get added to the fanout (a direct peer in a fanout doesn't make sense) or they should get filtered out before the fanout gets added to the mesh on subscription.
Consider the following scenario:
P1
andP2
get initiated as direct peers of each otherP1
subscribes to a topic"topic"
P2
publishes a message in topic"topic"
, this will create a fanout, but it gets not checked if the peers are direct peers (see https://github.com/libp2p/go-libp2p-pubsub/blob/2b5243c72f0d1a13a49d346e0f8391bbb0076f8d/gossipsub.go#L905), thereforeP1
will be part of the fanout ofP2
.P2
subscribes to the topic"topic"
and and the peers from the fanout will be added to the mesh which will result in aGRAFT
to peerP1
.The spec states:
Therefore I assume this is a bug and either direct peers shouldn't get added to the fanout (a direct peer in a fanout doesn't make sense) or they should get filtered out before the fanout gets added to the mesh on subscription.