1
1
import { CodeError , start , stop } from '@libp2p/interface'
2
- import { PeerSet } from '@libp2p/peer-collections'
3
2
import merge from 'it-merge'
4
3
import type { Routing as RoutingInterface , Provider , RoutingOptions } from '@helia/interface'
5
4
import type { AbortOptions , ComponentLogger , Logger , PeerId , PeerInfo , Startable } from '@libp2p/interface'
@@ -38,8 +37,6 @@ export class Routing implements RoutingInterface, Startable {
38
37
throw new CodeError ( 'No content routers available' , 'ERR_NO_ROUTERS_AVAILABLE' )
39
38
}
40
39
41
- const seen = new PeerSet ( )
42
-
43
40
for await ( const peer of merge (
44
41
...supports ( this . routers , 'findProviders' )
45
42
. map ( router => router . findProviders ( key , options ) )
@@ -50,13 +47,6 @@ export class Routing implements RoutingInterface, Startable {
50
47
continue
51
48
}
52
49
53
- // deduplicate peers
54
- if ( seen . has ( peer . id ) ) {
55
- continue
56
- }
57
-
58
- seen . add ( peer . id )
59
-
60
50
yield peer
61
51
}
62
52
}
@@ -142,8 +132,6 @@ export class Routing implements RoutingInterface, Startable {
142
132
throw new CodeError ( 'No peer routers available' , 'ERR_NO_ROUTERS_AVAILABLE' )
143
133
}
144
134
145
- const seen = new PeerSet ( )
146
-
147
135
for await ( const peer of merge (
148
136
...supports ( this . routers , 'getClosestPeers' )
149
137
. map ( router => router . getClosestPeers ( key , options ) )
@@ -152,13 +140,6 @@ export class Routing implements RoutingInterface, Startable {
152
140
continue
153
141
}
154
142
155
- // deduplicate peers
156
- if ( seen . has ( peer . id ) ) {
157
- continue
158
- }
159
-
160
- seen . add ( peer . id )
161
-
162
143
yield peer
163
144
}
164
145
}
0 commit comments