Skip to content

Commit

Permalink
fix(nodebuilder/p2p): LNs restricted to acting as DHT clients *only* (#…
Browse files Browse the repository at this point in the history
…3590)

Resolves #3574

Potentially targets #3573
  • Loading branch information
renaynay committed Jul 24, 2024
1 parent 081a0ad commit 4b2f507
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nodebuilder/p2p/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func contentRouting(r routing.PeerRouting) routing.ContentRouting {
// Basically, this provides a way to discover peer addresses by respecting public keys.
func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRouting, error) {
opts := []dht.Option{
dht.Mode(dht.ModeAuto),
dht.BootstrapPeers(params.Peers...),
dht.ProtocolPrefix(protocol.ID(fmt.Sprintf("/celestia/%s", params.Net))),
dht.Datastore(params.DataStore),
Expand All @@ -36,10 +35,17 @@ func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRo
)
}

if tp == node.Bridge || tp == node.Full {
switch tp {
case node.Light:
opts = append(opts,
dht.Mode(dht.ModeClient),
)
case node.Bridge, node.Full:
opts = append(opts,
dht.Mode(dht.ModeServer),
)
default:
return nil, fmt.Errorf("unsupported node type: %s", tp)
}

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

0 comments on commit 4b2f507

Please sign in to comment.