Skip to content

Commit 6549873

Browse files
renaynayWondertan
authored andcommitted
fix(nodebuilder/p2p): LNs restricted to acting as DHT clients *only* (#3590)
Resolves #3574 Potentially targets #3573
1 parent eb39fe8 commit 6549873

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

nodebuilder/p2p/routing.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func contentRouting(r routing.PeerRouting) routing.ContentRouting {
2323
// Basically, this provides a way to discover peer addresses by respecting public keys.
2424
func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRouting, error) {
2525
opts := []dht.Option{
26-
dht.Mode(dht.ModeAuto),
2726
dht.BootstrapPeers(params.Peers...),
2827
dht.ProtocolPrefix(protocol.ID(fmt.Sprintf("/celestia/%s", params.Net))),
2928
dht.Datastore(params.DataStore),
@@ -36,10 +35,17 @@ func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRo
3635
)
3736
}
3837

39-
if tp == node.Bridge || tp == node.Full {
38+
switch tp {
39+
case node.Light:
40+
opts = append(opts,
41+
dht.Mode(dht.ModeClient),
42+
)
43+
case node.Bridge, node.Full:
4044
opts = append(opts,
4145
dht.Mode(dht.ModeServer),
4246
)
47+
default:
48+
return nil, fmt.Errorf("unsupported node type: %s", tp)
4349
}
4450

4551
d, err := dht.New(params.Ctx, params.Host, opts...)

0 commit comments

Comments
 (0)